End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Command#show_lookup_failure
show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil)
lib/rubygems/command.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/rubygems/command.rb, line 158
def show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil)
gem = "'#{gem_name}' (#{version})"
msg = String.new "Could not find a valid gem #{gem}"
if errors && !errors.empty?
msg << ", here is why:\n"
errors.each {|x| msg << " #{x.wordy}\n" }
else
if required_by && gem != required_by
msg << " (required by #{required_by}) in any repository"
else
msg << " in any repository"
end
end
alert_error msg
unless suppress_suggestions
suggestions = Gem::SpecFetcher.fetcher.suggest_gems_from_name(gem_name, :latest, 10)
unless suggestions.empty?
alert_error "Possible alternatives: #{suggestions.join(", ")}"
end
end
end
Display to the user that a gem couldn’t be found and reasons why