mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix underscore version for bundler itself
Previously it wouldn't play nice with the bundler version finder.
d8bb81556d
This commit is contained in:
parent
ad638a713a
commit
ea5b136155
2 changed files with 35 additions and 1 deletions
|
@ -281,7 +281,7 @@ class Gem::Dependency
|
||||||
requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
|
requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
|
||||||
end.map(&:to_spec)
|
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
|
if platform_only
|
||||||
matches.reject! do |spec|
|
matches.reject! do |spec|
|
||||||
|
|
|
@ -375,6 +375,40 @@ class TestGem < Gem::TestCase
|
||||||
assert_equal %w(bundler-2.0.0), loaded_spec_names
|
assert_equal %w(bundler-2.0.0), loaded_spec_names
|
||||||
end
|
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
|
def test_self_bin_path_no_exec_name
|
||||||
e = assert_raises ArgumentError do
|
e = assert_raises ArgumentError do
|
||||||
Gem.bin_path 'a'
|
Gem.bin_path 'a'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue