summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/query_command.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
commitd22130922e7842226d38d59680e4bbb48a28a5f0 (patch)
tree39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/commands/query_command.rb
parent4752539e3f3e563d559732c52424206bd6f12dbd (diff)
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/query_command.rb')
-rw-r--r--lib/rubygems/commands/query_command.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 29e53065e72..d82f8aea609 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -80,10 +80,12 @@ class Gem::Commands::QueryCommand < Gem::Command
exit_code |= 1
end
- raise Gem::SystemExitException, exit_code
+ terminate_interaction exit_code
end
- dep = Gem::Dependency.new name, Gem::Requirement.default
+ req = Gem::Requirement.default
+ # TODO: deprecate for real
+ dep = Deprecate.skip_during { Gem::Dependency.new name, req }
if local? then
if prerelease and not both? then
@@ -96,7 +98,9 @@ class Gem::Commands::QueryCommand < Gem::Command
say
end
- specs = Gem.source_index.search dep
+ specs = Gem::Specification.find_all { |s|
+ s.name =~ name and req =~ s.version
+ }
spec_tuples = specs.map do |spec|
[[spec.name, spec.version, spec.original_platform, spec], :local]
@@ -129,9 +133,8 @@ class Gem::Commands::QueryCommand < Gem::Command
##
# Check if gem +name+ version +version+ is installed.
- def installed?(name, version = Gem::Requirement.default)
- dep = Gem::Dependency.new name, version
- !Gem.source_index.search(dep).empty?
+ def installed?(name, req = Gem::Requirement.default)
+ Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }
end
def output_query_results(spec_tuples)