mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
efbad5fa48
commit
e45d17b9d2
3 changed files with 14 additions and 9 deletions
|
@ -1,4 +1,10 @@
|
||||||
Sun Aug 8 16:08:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Aug 8 16:22:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
* gem_prelude.rb, lib/rubygems.rb (Gem.suffixes): return truely
|
* gem_prelude.rb, lib/rubygems.rb (Gem.suffixes): return truely
|
||||||
require-able suffixes only.
|
require-able suffixes only.
|
||||||
|
|
|
@ -473,12 +473,11 @@ module Gem
|
||||||
# versions of the same gem.
|
# versions of the same gem.
|
||||||
|
|
||||||
def self.find_files(path)
|
def self.find_files(path)
|
||||||
load_path_files = $LOAD_PATH.map do |load_path|
|
suffixes.map do |sfx|
|
||||||
files = Dir["#{File.expand_path path, load_path}#{Gem.suffix_pattern}"]
|
base = path + sfx
|
||||||
|
load_path_files = $LOAD_PATH.map {|load_path|
|
||||||
files.select do |load_path_file|
|
File.expand_path(base, load_path)
|
||||||
File.file? load_path_file.untaint
|
}.select {|f| File.file?(f.untaint)}
|
||||||
end
|
|
||||||
end.flatten
|
end.flatten
|
||||||
|
|
||||||
specs = searcher.find_all path
|
specs = searcher.find_all path
|
||||||
|
|
|
@ -69,8 +69,8 @@ class Gem::GemPathSearcher
|
||||||
|
|
||||||
def matching_files(spec, path)
|
def matching_files(spec, path)
|
||||||
return [] unless @lib_dirs[spec.object_id] # case no paths
|
return [] unless @lib_dirs[spec.object_id] # case no paths
|
||||||
glob = File.join @lib_dirs[spec.object_id], "#{path}#{Gem.suffix_pattern}"
|
load_path = File.join(@lib_dirs[spec.object_id], path)
|
||||||
Dir[glob].select { |f| File.file? f.untaint }
|
Gem.suffixes.map {|sfx| load_path + sfx}.select {|f| File.file?(f.untaint)}
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue