diff options
author | Edouard CHIN <[email protected]> | 2025-01-23 15:45:48 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2025-01-31 14:34:25 +0900 |
commit | dc7c66510523631e0ca316e9df73f0889666d937 (patch) | |
tree | 622cce59406dec33e8c6e160991137adc77dd4cf | |
parent | 57fec1e85f457c93d19e386e663ec0d927f9fae7 (diff) |
[rubygems/rubygems] Consolidated the Ruby version list:
- We keep 2 list of supported ruby versions and each time a new ruby
version is released we need to maintain both list. Forgetting
to update one would prevent users from adding gem for a specific
plaftorm (i.e. https://github.com/rubygems/rubygems/commit/7cd19d824d17 and https://github.com/rubygems/rubygems/commit/5462322f8f0c).
Extracted the list from the Dependency class and moved it to the
CurrentRuby class (which I believe was originally added for that
reason).
https://github.com/rubygems/rubygems/commit/a91edd6c1f
-rw-r--r-- | lib/bundler/current_ruby.rb | 23 | ||||
-rw-r--r-- | lib/bundler/dependency.rb | 15 |
2 files changed, 10 insertions, 28 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 1ba33c09e7..a4c87dfd57 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -9,26 +9,9 @@ module Bundler end class CurrentRuby - KNOWN_MINOR_VERSIONS = %w[ - 1.8 - 1.9 - 2.0 - 2.1 - 2.2 - 2.3 - 2.4 - 2.5 - 2.6 - 2.7 - 3.0 - 3.1 - 3.2 - 3.3 - 3.4 - 3.5 - ].freeze - - KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze + ALL_RUBY_VERSIONS = (18..27).to_a.concat((30..35).to_a).freeze + KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze + KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze KNOWN_PLATFORMS = %w[ jruby diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index 604dec37ad..a134a9f9cc 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -9,19 +9,18 @@ module Bundler attr_reader :autorequire attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref, :glob - ALL_RUBY_VERSIONS = (18..27).to_a.concat((30..35).to_a).freeze PLATFORM_MAP = { - ruby: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], - mri: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], + ruby: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS], + mri: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS], rbx: [Gem::Platform::RUBY], truffleruby: [Gem::Platform::RUBY], jruby: [Gem::Platform::JAVA, [18, 19]], - windows: [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS], + windows: [Gem::Platform::WINDOWS, CurrentRuby::ALL_RUBY_VERSIONS], # deprecated - mswin: [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS], - mswin64: [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]], - mingw: [Gem::Platform::MINGW, ALL_RUBY_VERSIONS], - x64_mingw: [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]], + mswin: [Gem::Platform::MSWIN, CurrentRuby::ALL_RUBY_VERSIONS], + mswin64: [Gem::Platform::MSWIN64, CurrentRuby::ALL_RUBY_VERSIONS - [18]], + mingw: [Gem::Platform::MINGW, CurrentRuby::ALL_RUBY_VERSIONS], + x64_mingw: [Gem::Platform::X64_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]], }.each_with_object({}) do |(platform, spec), hash| hash[platform] = spec[0] spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] } |