From 96741765d880b700933526a97a67345dfcd90c47 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 15 Apr 2021 12:47:18 +0900 Subject: Merge the master branch of RubyGems --- lib/rubygems/commands/update_command.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'lib/rubygems/commands/update_command.rb') diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 41770d9805..91d93e398c 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -81,7 +81,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 @@ -327,8 +327,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 -- cgit v1.2.3