method

execute

Importance_0
v2_1_10 - Show latest stable - 0 notes - Class: QueryCommand
execute() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# 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
Register or log in to add new notes.