diff options
author | Daniel Colson <danieljamescolson@gmail.com> | 2023-02-05 22:09:40 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-02-07 21:12:18 +0000 |
commit | fd71a76f55b84e02ba8a3b560baf9b1f996dedd4 (patch) | |
tree | 73e45cf1810805437a8476224fd37db79678c03d | |
parent | 23052e005e5683414791978321a40aca16a138fa (diff) |
[rubygems/rubygems] Add Ruby 3.2 and 3.3 platforms to Gemfile DSL
Along the same lines as https://github.com/rubygems/rubygems/pull/5469,
this adds support for Ruby 3.2 and 3.3 platforms: `:ruby_32`, `mri_32`,
etc.
It also includes a spec that should help catch this earlier in the
future, failing if we don't support platforms for the version of Ruby
that is running the tests.
https://github.com/rubygems/rubygems/commit/7cd19d824d
-rw-r--r-- | lib/bundler/current_ruby.rb | 2 | ||||
-rw-r--r-- | lib/bundler/dependency.rb | 2 | ||||
-rw-r--r-- | spec/bundler/bundler/dependency_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/bundler/dsl_spec.rb | 9 |
4 files changed, 25 insertions, 4 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index f9987c4da8..f009b07ad7 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -22,6 +22,8 @@ module Bundler 2.7 3.0 3.1 + 3.2 + 3.3 ].freeze KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index 1f8b9da2eb..5f17943629 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -9,7 +9,7 @@ module Bundler attr_reader :autorequire attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref - ALL_RUBY_VERSIONS = ((18..27).to_a + (30..31).to_a).freeze + ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze PLATFORM_MAP = { :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], diff --git a/spec/bundler/bundler/dependency_spec.rb b/spec/bundler/bundler/dependency_spec.rb index 9b9e2ddf0a..6e346c36c1 100644 --- a/spec/bundler/bundler/dependency_spec.rb +++ b/spec/bundler/bundler/dependency_spec.rb @@ -53,6 +53,8 @@ RSpec.describe Bundler::Dependency do :ruby_27 => Gem::Platform::RUBY, :ruby_30 => Gem::Platform::RUBY, :ruby_31 => Gem::Platform::RUBY, + :ruby_32 => Gem::Platform::RUBY, + :ruby_33 => Gem::Platform::RUBY, :mri => Gem::Platform::RUBY, :mri_18 => Gem::Platform::RUBY, :mri_19 => Gem::Platform::RUBY, @@ -66,6 +68,8 @@ RSpec.describe Bundler::Dependency do :mri_27 => Gem::Platform::RUBY, :mri_30 => Gem::Platform::RUBY, :mri_31 => Gem::Platform::RUBY, + :mri_32 => Gem::Platform::RUBY, + :mri_33 => Gem::Platform::RUBY, :rbx => Gem::Platform::RUBY, :truffleruby => Gem::Platform::RUBY, :jruby => Gem::Platform::JAVA, @@ -84,6 +88,8 @@ RSpec.describe Bundler::Dependency do :windows_27 => Gem::Platform::WINDOWS, :windows_30 => Gem::Platform::WINDOWS, :windows_31 => Gem::Platform::WINDOWS, + :windows_32 => Gem::Platform::WINDOWS, + :windows_33 => Gem::Platform::WINDOWS, :mswin => Gem::Platform::MSWIN, :mswin_18 => Gem::Platform::MSWIN, :mswin_19 => Gem::Platform::MSWIN, @@ -97,6 +103,8 @@ RSpec.describe Bundler::Dependency do :mswin_27 => Gem::Platform::MSWIN, :mswin_30 => Gem::Platform::MSWIN, :mswin_31 => Gem::Platform::MSWIN, + :mswin_32 => Gem::Platform::MSWIN, + :mswin_33 => Gem::Platform::MSWIN, :mswin64 => Gem::Platform::MSWIN64, :mswin64_19 => Gem::Platform::MSWIN64, :mswin64_20 => Gem::Platform::MSWIN64, @@ -109,6 +117,8 @@ RSpec.describe Bundler::Dependency do :mswin64_27 => Gem::Platform::MSWIN64, :mswin64_30 => Gem::Platform::MSWIN64, :mswin64_31 => Gem::Platform::MSWIN64, + :mswin64_32 => Gem::Platform::MSWIN64, + :mswin64_33 => Gem::Platform::MSWIN64, :mingw => Gem::Platform::MINGW, :mingw_18 => Gem::Platform::MINGW, :mingw_19 => Gem::Platform::MINGW, @@ -122,6 +132,8 @@ RSpec.describe Bundler::Dependency do :mingw_27 => Gem::Platform::MINGW, :mingw_30 => Gem::Platform::MINGW, :mingw_31 => Gem::Platform::MINGW, + :mingw_32 => Gem::Platform::MINGW, + :mingw_33 => Gem::Platform::MINGW, :x64_mingw => Gem::Platform::X64_MINGW, :x64_mingw_20 => Gem::Platform::X64_MINGW, :x64_mingw_21 => Gem::Platform::X64_MINGW, @@ -132,7 +144,9 @@ RSpec.describe Bundler::Dependency do :x64_mingw_26 => Gem::Platform::X64_MINGW, :x64_mingw_27 => Gem::Platform::X64_MINGW, :x64_mingw_30 => Gem::Platform::X64_MINGW, - :x64_mingw_31 => Gem::Platform::X64_MINGW } + :x64_mingw_31 => Gem::Platform::X64_MINGW, + :x64_mingw_32 => Gem::Platform::X64_MINGW, + :x64_mingw_33 => Gem::Platform::X64_MINGW } end # rubocop:enable Naming/VariableNumber diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb index 8cb51b8a52..8b5bf930f2 100644 --- a/spec/bundler/bundler/dsl_spec.rb +++ b/spec/bundler/bundler/dsl_spec.rb @@ -139,14 +139,19 @@ RSpec.describe Bundler::Dsl do describe "#gem" do # rubocop:disable Naming/VariableNumber [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :ruby_27, - :ruby_30, :ruby_31, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, - :mri_27, :mri_30, :mri_31, :jruby, :rbx, :truffleruby].each do |platform| + :ruby_30, :ruby_31, :ruby_32, :ruby_33, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, + :mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :jruby, :rbx, :truffleruby].each do |platform| it "allows #{platform} as a valid platform" do subject.gem("foo", :platform => platform) end end # rubocop:enable Naming/VariableNumber + it "allows platforms matching the running Ruby version" do + platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}" + subject.gem("foo", :platform => platform) + end + it "rejects invalid platforms" do expect { subject.gem("foo", :platform => :bogus) }. to raise_error(Bundler::GemfileError, /is not a valid platform/) |