From 4c2304f0004e9f1784540f3d36976aad9eab1f68 Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 22 Jul 2013 22:46:50 +0000 Subject: * lib/rubygems: Import RubyGems from master as of commit b165260 * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/query_command.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib/rubygems/commands/query_command.rb') diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index 7bda7383e2..05b214bb63 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -14,7 +14,7 @@ class Gem::Commands::QueryCommand < Gem::Command summary = 'Query gem information in local or remote repositories') super name, summary, :name => //, :domain => :local, :details => false, :versions => true, - :installed => false, :version => Gem::Requirement.default + :installed => nil, :version => Gem::Requirement.default add_option('-i', '--[no-]installed', 'Check for installed gem') do |value, options| @@ -67,15 +67,20 @@ class Gem::Commands::QueryCommand < Gem::Command name = options[:name] prerelease = options[:prerelease] - if options[:installed] then + unless options[:installed].nil? then if name.source.empty? then alert_error "You must specify a gem name" exit_code |= 4 - elsif installed? name, options[:version] then - say "true" else - say "false" - exit_code |= 1 + installed = installed? name, options[:version] + installed = !installed unless options[:installed] + + if installed then + say "true" + else + say "false" + exit_code |= 1 + end end terminate_interaction exit_code -- cgit v1.2.3