Skip to content

Commit 57fec1e

Browse files
Edouard-chinhsbt
authored andcommitted
[rubygems/rubygems] Add ruby_34 and ruby_35 as valid platform:
- Fix ruby/rubygems#8427 - Similar to ruby/rubygems@7cd19d824d17. Tweaked a bit the test supposed to prevent this error by checking whether the dep respond to these methods. ruby/rubygems@62012eaeb6
1 parent 366462b commit 57fec1e

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

lib/bundler/current_ruby.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class CurrentRuby
2424
3.1
2525
3.2
2626
3.3
27+
3.4
28+
3.5
2729
].freeze
2830

2931
KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze

spec/bundler/bundler/dependency_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,17 @@
170170
it "includes all platforms" do
171171
expect(subject).to eq(platforms.merge(deprecated))
172172
end
173+
174+
it "is on the current platform" do
175+
engine = Gem.win_platform? ? "windows" : RUBY_ENGINE
176+
177+
dep = described_class.new(
178+
"test_gem",
179+
"1.0.0",
180+
{ "platforms" => "#{engine}_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}" },
181+
)
182+
183+
expect(dep.current_platform?).to be_truthy
184+
end
173185
end
174186
end

spec/bundler/bundler/dsl_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@
201201
describe "#gem" do
202202
# rubocop:disable Naming/VariableNumber
203203
[:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :ruby_27,
204-
:ruby_30, :ruby_31, :ruby_32, :ruby_33, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24,
205-
:mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :jruby, :rbx, :truffleruby].each do |platform|
204+
:ruby_30, :ruby_31, :ruby_32, :ruby_33, :ruby_34, :ruby_35, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24,
205+
:mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :mri_34, :mri_35, :jruby, :rbx, :truffleruby].each do |platform|
206206
it "allows #{platform} as a valid platform" do
207207
subject.gem("foo", platform: platform)
208208
end
@@ -211,7 +211,9 @@
211211

212212
it "allows platforms matching the running Ruby version" do
213213
platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}"
214-
subject.gem("foo", platform: platform)
214+
215+
expect { subject.gem("foo", platform: platform) }.not_to raise_error
216+
expect(Bundler.current_ruby.respond_to?("#{platform}?")).to be_truthy
215217
end
216218

217219
it "rejects invalid platforms" do

0 commit comments

Comments
 (0)