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

[rubygems/rubygems] Improve error message when gems cannot be found

Include the source of each gem.

https://github.com/rubygems/rubygems/commit/a0bed2fb79
This commit is contained in:
David Rodríguez 2021-11-19 13:13:19 +01:00 committed by git
parent 82add06f9c
commit 01560e1c53
2 changed files with 7 additions and 3 deletions

View file

@ -495,7 +495,11 @@ module Bundler
"removed in order to install."
end
raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
"#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
end
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
end
unless specs["bundler"].any?

View file

@ -65,7 +65,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false
expect(err).to include("Could not find rack-0.9.1 in any of the sources")
expect(err).to include("Could not find rack-0.9.1 in locally installed gems")
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
@ -95,7 +95,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in locally installed gems")
expect(err).to include("Install missing gems with `bundle install`.")
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")