summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-08 07:22:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-08 07:22:07 +0000
commite45d17b9d24d3d70eb974f52a6e981b212f47f6c (patch)
treeb186891170d3bb1b51bad59c408db7ba5b0bda14 /lib
parentefbad5fa481a6e34f4d8b9f9355df2a6d7602a95 (diff)
* lib/rubygems.rb (Gem.find_files): fixed search order same as
default behavior. * lib/rubygems/gem_path_searcher.rb (matching_files): check if exist, not globbing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb11
-rw-r--r--lib/rubygems/gem_path_searcher.rb4
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 552c6f6b57..25da9d9cf8 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -473,12 +473,11 @@ module Gem
# versions of the same gem.
def self.find_files(path)
- load_path_files = $LOAD_PATH.map do |load_path|
- files = Dir["#{File.expand_path path, load_path}#{Gem.suffix_pattern}"]
-
- files.select do |load_path_file|
- File.file? load_path_file.untaint
- end
+ suffixes.map do |sfx|
+ base = path + sfx
+ load_path_files = $LOAD_PATH.map {|load_path|
+ File.expand_path(base, load_path)
+ }.select {|f| File.file?(f.untaint)}
end.flatten
specs = searcher.find_all path
diff --git a/lib/rubygems/gem_path_searcher.rb b/lib/rubygems/gem_path_searcher.rb
index 6ee3c078d5..a745b0291c 100644
--- a/lib/rubygems/gem_path_searcher.rb
+++ b/lib/rubygems/gem_path_searcher.rb
@@ -69,8 +69,8 @@ class Gem::GemPathSearcher
def matching_files(spec, path)
return [] unless @lib_dirs[spec.object_id] # case no paths
- glob = File.join @lib_dirs[spec.object_id], "#{path}#{Gem.suffix_pattern}"
- Dir[glob].select { |f| File.file? f.untaint }
+ load_path = File.join(@lib_dirs[spec.object_id], path)
+ Gem.suffixes.map {|sfx| load_path + sfx}.select {|f| File.file?(f.untaint)}
end
##