1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Simplify error message building in resolver

Since all requirements have an explicit source now (even if it's the
default source).

2c341cfc22
This commit is contained in:
David Rodríguez 2021-07-31 13:33:08 +02:00 committed by Hiroshi SHIBATA
parent b17cdad2f8
commit b351cebab2
Notes: git 2021-08-31 19:07:21 +09:00

View file

@ -269,14 +269,12 @@ module Bundler
"Try running `bundle update #{name}`\n\n" \ "Try running `bundle update #{name}`\n\n" \
"If you are updating multiple gems in your Gemfile at once,\n" \ "If you are updating multiple gems in your Gemfile at once,\n" \
"try passing them all to `bundle update`" "try passing them all to `bundle update`"
elsif source = @source_requirements[name] else
source = source_for(name)
specs = source.specs.search(name) specs = source.specs.search(name)
versions_with_platforms = specs.map {|s| [s.version, s.platform] } versions_with_platforms = specs.map {|s| [s.version, s.platform] }
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n") message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any? message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
else
message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
"listed in your Gemfile#{cache_message}."
end end
raise GemNotFound, message raise GemNotFound, message
end end