method
execute
v2_2_9 -
Show latest stable
- Class:
Gem::Commands::QueryCommand
execute()public
No documentation available.
# File lib/rubygems/commands/query_command.rb, line 73
def execute
exit_code = 0
if options[:args].to_a.empty? and options[:name].source.empty?
name = options[:name]
no_name = true
elsif !options[:name].source.empty?
name = Array(options[:name])
else
name = options[:args].to_a.map{|arg| /#{arg}/ }
end
prerelease = options[:prerelease]
unless options[:installed].nil? then
if no_name then
alert_error "You must specify a gem name"
exit_code |= 4
elsif name.count > 1
alert_error "You must specify only ONE gem!"
exit_code |= 4
else
installed = installed? name.first, options[:version]
installed = !installed unless options[:installed]
if installed then
say "true"
else
say "false"
exit_code |= 1
end
end
terminate_interaction exit_code
end
names = Array(name)
names.each { |n| show_gems n, prerelease }
end