execute (Gem::Commands::FetchCommand)

    # File lib/rubygems/commands/fetch_command.rb, line 34
      def execute
        version = options[:version] || Gem::Requirement.default
        all = Gem::Requirement.default

        gem_names = get_all_gem_names

        gem_names.each do |gem_name|
          dep = Gem::Dependency.new gem_name, version

          specs_and_sources = Gem::SpecFetcher.fetcher.fetch dep, all

          specs_and_sources.sort_by { |spec,| spec.version }

          spec, source_uri = specs_and_sources.last

          if spec.nil? then
            alert_error "Could not find #{gem_name} in any repository"
            next
          end

          path = Gem::RemoteFetcher.fetcher.download spec, source_uri
          FileUtils.mv path, "#{spec.full_name}.gem"

          say "Downloaded #{spec.full_name}"
        end
      end