Display to the user that a gem couldn’t be found and reasons why
# File lib/rubygems/command.rb, line 155
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 << ", here is why:\n"
errors.each { |x| msg << " #{x.wordy}\n" }
else
if required_by and gem != required_by
msg << " (required by #{required_by}) in any repository"
else
msg << " in any repository"
end
end
alert_error msg
unless domain == :local # HACK
suggestions = Gem::SpecFetcher.fetcher.suggest_gems_from_name gem_name
unless suggestions.empty?
alert_error "Possible alternatives: #{suggestions.join(", ")}"
end
end
end