diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-28 02:30:28 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-28 02:30:28 +0000 |
commit | 7893dc9a910a3a0fdd3d2f478727468805fec177 (patch) | |
tree | 68dfd6268aaec3e70a953647e8b737d1e26aba4b | |
parent | b177a87a1c48e3d763f94ab327a6532d51eb9a51 (diff) | |
download | ruby-7893dc9a910a3a0fdd3d2f478727468805fec177.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 14 |
3 files changed, 22 insertions, 1 deletions
@@ -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. diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 8783756cd9..6b2016fd9b 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -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 diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index e78f874b4e..931c9e498d 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -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' |