diff options
Diffstat (limited to 'lib/rubygems/commands/sources_command.rb')
-rw-r--r-- | lib/rubygems/commands/sources_command.rb | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index 245ab91c9f..571e664272 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -1,4 +1,9 @@ -require 'fileutils' +###################################################################### +# This file is imported from the rubygems project. +# DO NOT make modifications in this repo. They _will_ be reverted! +# File a patch instead and assign it to Ryan Davis or Eric Hodel. +###################################################################### + require 'rubygems/command' require 'rubygems/remote_fetcher' require 'rubygems/source_info_cache' @@ -10,6 +15,8 @@ class Gem::Commands::SourcesCommand < Gem::Command include Gem::LocalRemoteOptions def initialize + require 'fileutils' + super 'sources', 'Manage the sources and cache file RubyGems uses to search for gems' @@ -79,23 +86,7 @@ class Gem::Commands::SourcesCommand < Gem::Command rescue URI::Error, ArgumentError say "#{source_uri} is not a URI" rescue Gem::RemoteFetcher::FetchError => e - yaml_uri = uri + 'yaml' - gem_repo = Gem::RemoteFetcher.fetcher.fetch_size yaml_uri rescue false - - if e.uri =~ /specs\.#{Regexp.escape Gem.marshal_version}\.gz$/ and - gem_repo then - - alert_warning <<-EOF -RubyGems 1.2+ index not found for: -\t#{source_uri} - -Will cause RubyGems to revert to legacy indexes, degrading performance. - EOF - - say "#{source_uri} added to sources" - else - say "Error fetching #{source_uri}:\n\t#{e.message}" - end + say "Error fetching #{source_uri}:\n\t#{e.message}" end end @@ -115,15 +106,10 @@ Will cause RubyGems to revert to legacy indexes, degrading performance. if options[:update] then fetcher = Gem::SpecFetcher.fetcher - if fetcher.legacy_repos.empty? then - Gem.sources.each do |update_uri| - update_uri = URI.parse update_uri - fetcher.load_specs update_uri, 'specs' - fetcher.load_specs update_uri, 'latest_specs' - end - else - Gem::SourceInfoCache.cache true - Gem::SourceInfoCache.cache.flush + Gem.sources.each do |update_uri| + update_uri = URI.parse update_uri + fetcher.load_specs update_uri, 'specs' + fetcher.load_specs update_uri, 'latest_specs' end say "source cache successfully updated" |