From b551e8c8b36766651be4e782e09e3b02e7d14a10 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 22 Feb 2010 02:52:35 +0000 Subject: * lib/rubygems: update to 1.3.6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/gem_path_searcher.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 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 2232a574e3..6ee3c078d5 100644 --- a/lib/rubygems/gem_path_searcher.rb +++ b/lib/rubygems/gem_path_searcher.rb @@ -1,9 +1,3 @@ -#-- -# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. -# All rights reserved. -# See LICENSE.txt for permissions. -#++ - ## # GemPathSearcher has the capability to find loadable files inside # gems. It generates data up front to speed up searches later. @@ -14,14 +8,16 @@ class Gem::GemPathSearcher # Initialise the data we need to make searches later. def initialize - # We want a record of all the installed gemspecs, in the order - # we wish to examine them. + # We want a record of all the installed gemspecs, in the order we wish to + # examine them. @gemspecs = init_gemspecs - # Map gem spec to glob of full require_path directories. - # Preparing this information may speed up searches later. + + # Map gem spec to glob of full require_path directories. Preparing this + # information may speed up searches later. @lib_dirs = {} + @gemspecs.each do |spec| - @lib_dirs[spec.object_id] = lib_dirs_for(spec) + @lib_dirs[spec.object_id] = lib_dirs_for spec end end @@ -72,6 +68,7 @@ class Gem::GemPathSearcher # Some of the intermediate results are cached in @lib_dirs for speed. 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 } end @@ -95,7 +92,8 @@ class Gem::GemPathSearcher # '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}' def lib_dirs_for(spec) - "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" + "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" if + spec.require_paths end end -- cgit v1.2.3