summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-03-24 04:52:19 +0900
committerGitHub <noreply@github.com>2021-03-24 04:52:19 +0900
commit2efda212b0d9ad5ec265271db25ad51d796fde44 (patch)
treeb2667694205da0fd71dfa8dafc2655f6d464896e /lib/rubygems
parentff2ea4daeb795ebb3d0afa8c57d86a4af9757e50 (diff)
Merge RubyGems-3.2.15 and Bundler-2.2.15 (#4311)
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/commands/update_command.rb24
-rw-r--r--lib/rubygems/security/trust_dir.rb1
2 files changed, 22 insertions, 3 deletions
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index fcc52c293e..8d168d1cbd 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -76,7 +76,7 @@ command to remove old versions.
def check_oldest_rubygems(version) # :nodoc:
if oldest_supported_version > version
- alert_error "rubygems #{version} is not supported. The oldest supported version is #{oldest_supported_version}"
+ alert_error "rubygems #{version} is not supported on #{RUBY_VERSION}. The oldest version supported by this ruby is #{oldest_supported_version}"
terminate_interaction 1
end
end
@@ -322,8 +322,26 @@ command to remove old versions.
private
+ #
+ # Oldest version we support downgrading to. This is the version that
+ # originally ships with the first patch version of each ruby, because we never
+ # test each ruby against older rubygems, so we can't really guarantee it
+ # works. Version list can be checked here: https://stdgems.org/rubygems
+ #
def oldest_supported_version
- # for Ruby 2.3
- @oldest_supported_version ||= Gem::Version.new("2.5.2")
+ @oldest_supported_version ||=
+ if Gem.ruby_version > Gem::Version.new("3.0.a")
+ Gem::Version.new("3.2.3")
+ elsif Gem.ruby_version > Gem::Version.new("2.7.a")
+ Gem::Version.new("3.1.2")
+ elsif Gem.ruby_version > Gem::Version.new("2.6.a")
+ Gem::Version.new("3.0.1")
+ elsif Gem.ruby_version > Gem::Version.new("2.5.a")
+ Gem::Version.new("2.7.3")
+ elsif Gem.ruby_version > Gem::Version.new("2.4.a")
+ Gem::Version.new("2.6.8")
+ else
+ Gem::Version.new("2.5.2")
+ end
end
end
diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb
index 1d93ceabd1..456947274c 100644
--- a/lib/rubygems/security/trust_dir.rb
+++ b/lib/rubygems/security/trust_dir.rb
@@ -104,6 +104,7 @@ class Gem::Security::TrustDir
# permissions.
def verify
+ require 'fileutils'
if File.exist? @dir
raise Gem::Security::Exception,
"trust directory #{@dir} is not a directory" unless