method
execute
v1_9_3_392 -
Show latest stable
-
0 notes -
Class: QueryCommand
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
execute()
public
Hide source
# File lib/rubygems/commands/query_command.rb, line 60 def execute exit_code = 0 name = options[:name] prerelease = options[:prerelease] if options[:installed] 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 end terminate_interaction exit_code end req = Gem::Requirement.default # TODO: deprecate for real dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req } if local? then if prerelease and not both? then alert_warning "prereleases are always shown locally" end if ui.outs.tty? or both? then say say "*** LOCAL GEMS ***" say end 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] end output_query_results spec_tuples end if remote? then if ui.outs.tty? or both? then say say "*** REMOTE GEMS ***" say end all = options[:all] fetcher = Gem::SpecFetcher.fetcher spec_tuples = fetcher.find_matching dep, all, false, prerelease spec_tuples += fetcher.find_matching dep, false, false, true if prerelease and all output_query_results spec_tuples end end