aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/dependency.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:26:39 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:26:39 +0000
commit7fbb9078fe61104606a40e4e450a2cd1a33f8ca1 (patch)
treebd57731d31e70e0b5837bcff618f0b56b2be3b5e /lib/rubygems/dependency.rb
parent6cc4937aec6596bff58fc946b4b00c7b546e494a (diff)
downloadruby-7fbb9078fe61104606a40e4e450a2cd1a33f8ca1.tar.gz
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.2.
Please see entries of 2.6.2 on https://github.com/rubygems/rubygems/blob/master/History.txt git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/dependency.rb')
-rw-r--r--lib/rubygems/dependency.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index bf24b6e724..b7aea4692b 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -286,7 +286,9 @@ class Gem::Dependency
}
end
- matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
+ # `stubs_for` returns oldest first, but `matching_specs` is supposed to
+ # return newest first, so just reverse the list
+ matches.reverse
end
##
@@ -302,14 +304,13 @@ class Gem::Dependency
# TODO: check Gem.activated_spec[self.name] in case matches falls outside
if matches.empty? then
- specs = Gem::Specification.find_all { |s|
- s.name == name
- }.map { |x| x.full_name }
+ specs = Gem::Specification.stubs_for name
if specs.empty?
- total = Gem::Specification.to_a.size
+ total = Gem::Specification.stubs.size
msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n".dup
else
+ specs = specs.map(&:full_name)
msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n".dup
end
msg << "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"
@@ -334,6 +335,6 @@ class Gem::Dependency
matches.delete_if { |spec| spec.nil? || spec.version.prerelease? } unless prerelease?
- matches.last
+ matches.first
end
end