summaryrefslogtreecommitdiff
path: root/lib/rubygems/gem_path_searcher.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
commitd22130922e7842226d38d59680e4bbb48a28a5f0 (patch)
tree39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/gem_path_searcher.rb
parent4752539e3f3e563d559732c52424206bd6f12dbd (diff)
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/gem_path_searcher.rb')
-rw-r--r--lib/rubygems/gem_path_searcher.rb26
1 files changed, 22 insertions, 4 deletions
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