1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems.rb: Fix Gem.find_spec_for_exe picks oldest gem.

https://github.com/travis-ci/travis-ci/issues/5798
  https://github.com/rubygems/rubygems/pull/1566
* test/rubygems/test_gem.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-03-28 02:30:28 +00:00
parent 7fbb9078fe
commit 64ce7711c0
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Mon Mar 28 11:30:23 2016 Shinichi Maeshima <netwillnet@gmail.com>
* lib/rubygems.rb: Fix `Gem.find_spec_for_exe` picks oldest gem.
https://github.com/travis-ci/travis-ci/issues/5798
https://github.com/rubygems/rubygems/pull/1566
* test/rubygems/test_gem.rb: ditto.
Mon Mar 28 11:26:31 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.2.

View file

@ -254,7 +254,7 @@ module Gem
spec.executables.include? exec_name
} if exec_name
unless spec = specs.last
unless spec = specs.first
msg = "can't find gem #{name} (#{requirements}) with executable #{exec_name}"
raise Gem::GemNotFoundException, msg
end

View file

@ -143,6 +143,20 @@ class TestGem < Gem::TestCase
assert_match 'a-1/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
end
def test_self_bin_path_picking_newest
a1 = util_spec 'a', '1' do |s|
s.executables = ['exec']
end
a2 = util_spec 'a', '2' do |s|
s.executables = ['exec']
end
install_specs a1, a2
assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
end
def test_self_bin_path_no_exec_name
e = assert_raises ArgumentError do
Gem.bin_path 'a'