execute (Gem::Commands::SpecificationCommand)

    # File lib/rubygems/commands/specification_command.rb, line 39
      def execute
        specs = []
        gem = get_one_gem_name

        if local? then
          source_index = Gem::SourceIndex.from_installed_gems
          specs.push(*source_index.search(/\A#{gem}\z/, options[:version]))
        end

        if remote? then
          alert_warning "Remote information is not complete\n\n"

          Gem::SourceInfoCache.cache_data.each do |_,sice|
            specs.push(*sice.source_index.search(gem, options[:version]))
          end
        end

        if specs.empty? then
          alert_error "Unknown gem '#{gem}'"
          terminate_interaction 1
        end

        output = lambda { |spec| say spec.to_yaml; say "\n" }

        if options[:all] then
          specs.each(&output)
        else
          spec = specs.sort_by { |spec| spec.version }.last
          output[spec]
        end
      end