ruby-changes:57925
From: David <ko1@a...>
Date: Thu, 26 Sep 2019 19:27:55 +0900 (JST)
Subject: [ruby-changes:57925] ea5b136155 (master): [rubygems/rubygems] Fix underscore version for bundler itself
https://git.ruby-lang.org/ruby.git/commit/?id=ea5b136155 From ea5b1361557690569a33204c122a08f2faefdf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Tue, 10 Sep 2019 11:07:03 +0200 Subject: [rubygems/rubygems] Fix underscore version for bundler itself Previously it wouldn't play nice with the bundler version finder. https://github.com/rubygems/rubygems/commit/d8bb81556d diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb index a033603..b09a5fe 100644 --- a/lib/rubygems/dependency.rb +++ b/lib/rubygems/dependency.rb @@ -281,7 +281,7 @@ class Gem::Dependency https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency.rb#L281 requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version) end.map(&:to_spec) - Gem::BundlerVersionFinder.filter!(matches) if name == "bundler".freeze + Gem::BundlerVersionFinder.filter!(matches) if name == "bundler".freeze && !requirement.specific? if platform_only matches.reject! do |spec| diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index b250684..110eef6 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -375,6 +375,40 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L375 assert_equal %w(bundler-2.0.0), loaded_spec_names end + def test_activate_bin_path_respects_underscore_selection_if_given + bundler_latest = util_spec 'bundler', '2.0.1' do |s| + s.executables = ['bundle'] + end + + bundler_previous = util_spec 'bundler', '1.17.3' do |s| + s.executables = ['bundle'] + end + + install_specs bundler_latest, bundler_previous + + File.open("Gemfile.lock", "w") do |f| + f.write <<-L.gsub(/ {8}/, "") + GEM + remote: https://rubygems.org/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + 2.0.1 + L + end + + File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') } + + load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3") + + assert_equal %w(bundler-1.17.3), loaded_spec_names + end + def test_self_bin_path_no_exec_name e = assert_raises ArgumentError do Gem.bin_path 'a' -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/