Skip to content

Commit

Permalink
Set correct required_ruby_version when some RUBY_CC_VERSIONs are …
Browse files Browse the repository at this point in the history
…missing (#199)

The required_ruby_version was set twice, although one in define_native_tasks is enough.

Fixes #198
  • Loading branch information
larskanis committed Jan 17, 2022
1 parent a04f7d4 commit 2b67583
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions lib/rake/extensiontask.rb
Expand Up @@ -377,9 +377,6 @@ def define_cross_platform_tasks(for_platform)
@lib_dir = "#{@lib_dir}/#{$1}"
end

# Update cross compiled platform/version combinations
@ruby_versions_per_platform[for_platform] << version

define_cross_platform_tasks_with_version(for_platform, version)

# restore lib_dir
Expand Down
9 changes: 6 additions & 3 deletions spec/lib/rake/extensiontask_spec.rb
Expand Up @@ -456,14 +456,17 @@

it "should set required_ruby_version from RUBY_CC_VERSION, set platform, clear extensions but keep metadata" do
platforms = ["x86-mingw32", "x64-mingw32"]
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1"]
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1", "2.11.0"]
ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
config = Hash.new
ruby_cc_versions.each do |ruby_cc_version|
platforms.each do |platform|
unless platform == "x64-mingw32" && ruby_cc_version == "2.11.0"
rbconf = "/rubies/#{ruby_cc_version}/rbconfig.rb"
end
allow(config).to receive(:[]).
with("rbconfig-#{platform}-#{ruby_cc_version}").
and_return("/rubies/#{ruby_cc_version}/rbconfig.rb")
and_return(rbconf)
end
end
allow(YAML).to receive(:load_file).and_return(config)
Expand All @@ -490,7 +493,7 @@
end

expected_required_ruby_versions = [
Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
Gem::Requirement.new([">= 1.8", "< 2.12.dev"]),
Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
]
cross_specs.collect(&:required_ruby_version).should == expected_required_ruby_versions
Expand Down

0 comments on commit 2b67583

Please sign in to comment.