Skip to content

Commit 7a26be6

Browse files
Merge pull request #7960 from rubygems/deivid-rodriguez/vendor-securerandom
Fix `gem exec rails new project` failing on Ruby 3.2 (cherry picked from commit 7de3224)
1 parent 1dd90b9 commit 7a26be6

File tree

13 files changed

+512
-11
lines changed

13 files changed

+512
-11
lines changed

.github/workflows/install-rubygems.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ jobs:
8585
- name: Check bundler install didn't hit the network
8686
run: if grep -q 'GET http' output.txt; then false; else true; fi
8787
working-directory: ./bundler
88-
- name: Workaround bad nio4r release on JRuby, so that Rails can be installed below
89-
run: gem install nio4r --version 2.7.1
90-
if: matrix.ruby.name == 'jruby'
88+
- name: Check gem exec can create a rails project
89+
run: gem exec rails new app --minimal
90+
if: matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby'
9191
- name: Check rails can be installed
9292
run: gem install rails --verbose --backtrace
9393
timeout-minutes: 10

Manifest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,10 @@ lib/rubygems/vendor/optparse/lib/optparse/version.rb
585585
lib/rubygems/vendor/resolv/.document
586586
lib/rubygems/vendor/resolv/LICENSE.txt
587587
lib/rubygems/vendor/resolv/lib/resolv.rb
588+
lib/rubygems/vendor/securerandom/.document
589+
lib/rubygems/vendor/securerandom/LICENSE.txt
590+
lib/rubygems/vendor/securerandom/lib/random/formatter.rb
591+
lib/rubygems/vendor/securerandom/lib/securerandom.rb
588592
lib/rubygems/vendor/timeout/.document
589593
lib/rubygems/vendor/timeout/LICENSE.txt
590594
lib/rubygems/vendor/timeout/lib/timeout.rb

lib/rubygems/vendor/net-http/lib/net/https.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
= net/https -- SSL/TLS enhancement for Gem::Net::HTTP.
55
66
This file has been merged with net/http. There is no longer any need to
7-
require 'rubygems/vendor/net-http/lib/net/https' to use HTTPS.
7+
require_relative 'https' to use HTTPS.
88
99
See Gem::Net::HTTP for details on how to make HTTPS connections.
1010

lib/rubygems/vendor/optparse/lib/optparse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ def compsys(to, name = File.basename($0)) # :nodoc:
10841084
Switch::OptionalArgument.new do |pkg|
10851085
if pkg
10861086
begin
1087-
require 'rubygems/vendor/optparse/lib/optparse/version'
1087+
require_relative 'optparse/version'
10881088
rescue LoadError
10891089
else
10901090
show_version(*pkg.split(/,/)) or

lib/rubygems/vendor/resolv/lib/resolv.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require 'io/wait'
66

77
begin
8-
require 'securerandom'
8+
require_relative '../../securerandom/lib/securerandom'
99
rescue LoadError
1010
end
1111

@@ -602,10 +602,10 @@ def extract_resources(msg, name, typeclass) # :nodoc:
602602
}
603603
end
604604

605-
if defined? SecureRandom
605+
if defined? Gem::SecureRandom
606606
def self.random(arg) # :nodoc:
607607
begin
608-
SecureRandom.random_number(arg)
608+
Gem::SecureRandom.random_number(arg)
609609
rescue NotImplementedError
610610
rand(arg)
611611
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Vendored files do not need to be documented
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions
5+
are met:
6+
1. Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
2. Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
12+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22+
SUCH DAMAGE.

0 commit comments

Comments
 (0)