From d22130922e7842226d38d59680e4bbb48a28a5f0 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 1 Jun 2011 03:45:05 +0000 Subject: Import rubygems 1.8.5 (released @ 137c80f) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/gem_path_searcher.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'lib/rubygems/gem_path_searcher.rb') diff --git a/lib/rubygems/gem_path_searcher.rb b/lib/rubygems/gem_path_searcher.rb index 79c3b0f6c9..36a86dec0a 100644 --- a/lib/rubygems/gem_path_searcher.rb +++ b/lib/rubygems/gem_path_searcher.rb @@ -4,6 +4,9 @@ # File a patch instead and assign it to Ryan Davis or Eric Hodel. ###################################################################### +require "rubygems" +require "rubygems/deprecate" + ## # GemPathSearcher has the capability to find loadable files inside # gems. It generates data up front to speed up searches later. @@ -56,6 +59,15 @@ class Gem::GemPathSearcher end end + # Looks through the available gemspecs and finds the first + # one that contains +file+ as a requirable file. + + def find_spec_for_file(file) + @gemspecs.find do |spec| + return spec if spec.contains_requirable_file?(file) + end + end + def find_active(glob) # HACK violation of encapsulation @gemspecs.find do |spec| @@ -138,9 +150,7 @@ class Gem::GemPathSearcher # in reverse version order. (bar-2, bar-1, foo-2) def init_gemspecs - specs = Gem.source_index.map { |_, spec| spec } - - specs.sort { |a, b| + Gem::Specification.sort { |a, b| names = a.name <=> b.name next names if names.nonzero? b.version <=> a.version @@ -156,5 +166,13 @@ class Gem::GemPathSearcher spec.require_paths end -end + extend Deprecate + deprecate :initialize, :none, 2011, 10 + deprecate :find, :none, 2011, 10 + deprecate :find_active, :none, 2011, 10 + deprecate :find_all, :none, 2011, 10 + deprecate :find_in_unresolved, :none, 2011, 10 + deprecate :find_in_unresolved_tree, :none, 2011, 10 + deprecate :find_spec_for_file, :none, 2011, 10 +end -- cgit v1.2.3