diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
commit | d22130922e7842226d38d59680e4bbb48a28a5f0 (patch) | |
tree | 39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/commands/which_command.rb | |
parent | 4752539e3f3e563d559732c52424206bd6f12dbd (diff) | |
download | ruby-d22130922e7842226d38d59680e4bbb48a28a5f0.tar.gz |
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/commands/which_command.rb')
-rw-r--r-- | lib/rubygems/commands/which_command.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb index aeb91f203c..2962491bde 100644 --- a/lib/rubygems/commands/which_command.rb +++ b/lib/rubygems/commands/which_command.rb @@ -5,12 +5,8 @@ ###################################################################### require 'rubygems/command' -require 'rubygems/gem_path_searcher' class Gem::Commands::WhichCommand < Gem::Command - - EXT = %w[.rb .rbw .so .dll .bundle] # HACK - def initialize super 'which', 'Find the location of a library file you can require', :search_gems_first => false, :show_all => false @@ -34,14 +30,13 @@ class Gem::Commands::WhichCommand < Gem::Command end def execute - searcher = Gem::GemPathSearcher.new - found = false options[:args].each do |arg| - arg = arg.sub(/#{Regexp.union(*EXT)}$/, '') + arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, '') dirs = $LOAD_PATH - spec = searcher.find arg + + spec = Gem::Specification.find_by_path arg if spec then if options[:search_gems_first] then @@ -51,6 +46,7 @@ class Gem::Commands::WhichCommand < Gem::Command end end + # TODO: this is totally redundant and stupid paths = find_paths arg, dirs if paths.empty? then @@ -68,7 +64,7 @@ class Gem::Commands::WhichCommand < Gem::Command result = [] dirs.each do |dir| - EXT.each do |ext| + Gem.suffixes.each do |ext| full_path = File.join dir, "#{package_name}#{ext}" if File.exist? full_path then result << full_path |