summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/fetch_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/fetch_command.rb')
-rw-r--r--lib/rubygems/commands/fetch_command.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index b12e1b4a5d..43229c0512 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -34,7 +34,7 @@ class Gem::Commands::FetchCommand < Gem::Command
def execute
version = options[:version] || Gem::Requirement.default
- all = Gem::Requirement.default
+ all = Gem::Requirement.default != version
gem_names = get_all_gem_names
@@ -42,13 +42,17 @@ class Gem::Commands::FetchCommand < Gem::Command
dep = Gem::Dependency.new gem_name, version
dep.prerelease = options[:prerelease]
- specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, false, true,
+ specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, all, true,
dep.prerelease?)
+ specs_and_sources, errors =
+ Gem::SpecFetcher.fetcher.fetch_with_errors(dep, all, true,
+ dep.prerelease?)
+
spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
if spec.nil? then
- alert_error "Could not find #{gem_name} in any repository"
+ show_lookup_failure gem_name, version, errors
next
end