[前][次][番号順一覧][スレッド一覧]

ruby-changes:16924

From: nobu <ko1@a...>
Date: Sun, 8 Aug 2010 16:22:19 +0900 (JST)
Subject: [ruby-changes:16924] Ruby:r28920 (trunk): * lib/rubygems.rb (Gem.find_files): fixed search order same as

nobu	2010-08-08 16:22:07 +0900 (Sun, 08 Aug 2010)

  New Revision: 28920

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28920

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/gem_path_searcher.rb
    trunk/lib/rubygems.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28919)
+++ ChangeLog	(revision 28920)
@@ -1,5 +1,11 @@
-Sun Aug  8 16:08:51 2010  Nobuyoshi Nakada  <nobu@r...>
+Sun Aug  8 16:22:04 2010  Nobuyoshi Nakada  <nobu@r...>
 
+	* 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
 	  require-able suffixes only.
 
Index: lib/rubygems/gem_path_searcher.rb
===================================================================
--- lib/rubygems/gem_path_searcher.rb	(revision 28919)
+++ lib/rubygems/gem_path_searcher.rb	(revision 28920)
@@ -69,8 +69,8 @@
 
   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
 
   ##
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 28919)
+++ lib/rubygems.rb	(revision 28920)
@@ -473,12 +473,11 @@
   # 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]