summaryrefslogtreecommitdiff
path: root/lib/rubygems/command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
commit8da8d4b043c37b53a69803c71ff36b478d4776d0 (patch)
tree7c8cec15645e74f19c88e4eb5b210b96174c7d03 /lib/rubygems/command.rb
parentc5cb386eba6d9a2d9a8e6ffa8c30137d0c4660c1 (diff)
Merge RubyGems 3.0.0.beta1.
* It drop to support < Ruby 2.2 * Cleanup deprecated methods and classes. * Mark obsoleted methods to deprecate. * and other enhancements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/command.rb')
-rw-r--r--lib/rubygems/command.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index a7ec212e51..71199c59b4 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -152,15 +152,23 @@ class Gem::Command
#--
# TODO: replace +domain+ with a parameter to suppress suggestions
- def show_lookup_failure(gem_name, version, errors, domain)
+ def show_lookup_failure(gem_name, version, errors, domain, required_by = nil)
+ gem = "'#{gem_name}' (#{version})"
+ msg = String.new "Could not find a valid gem #{gem}"
+
if errors and !errors.empty?
- msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n".dup
+ msg << ", here is why:\n"
errors.each { |x| msg << " #{x.wordy}\n" }
- alert_error msg
else
- alert_error "Could not find a valid gem '#{gem_name}' (#{version}) in any repository"
+ if required_by and gem != required_by then
+ msg << " (required by #{required_by}) in any repository"
+ else
+ msg << " in any repository"
+ end
end
+ alert_error msg
+
unless domain == :local then # HACK
suggestions = Gem::SpecFetcher.fetcher.suggest_gems_from_name gem_name