def execute
exit_code = 0
name = options[:name]
if options[:installed] then
if name.source.empty? then
alert_error "You must specify a gem name"
exit_code |= 4
elsif installed? name.source, options[:version] then
say "true"
else
say "false"
exit_code |= 1
end
raise Gem::SystemExitException, exit_code
end
if local? then
say
say "*** LOCAL GEMS ***"
say
output_query_results Gem.source_index.search(name)
end
if remote? then
say
say "*** REMOTE GEMS ***"
say
all = options[:all]
begin
Gem::SourceInfoCache.cache all
rescue Gem::RemoteFetcher::FetchError
end
output_query_results Gem::SourceInfoCache.search(name, false, all)
end
end