diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-11-19 13:13:19 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-07-18 19:07:47 +0900 |
commit | 01560e1c53ce2e1fcf3cdc2480c6f75ca7c6f0a6 (patch) | |
tree | 7e24ede96729c49aac0055a38ce65e339e6ca2ab | |
parent | 82add06f9cbe00ad611e99692d8d49b77159c601 (diff) | |
download | ruby-01560e1c53ce2e1fcf3cdc2480c6f75ca7c6f0a6.tar.gz |
[rubygems/rubygems] Improve error message when gems cannot be found
Include the source of each gem.
https://github.com/rubygems/rubygems/commit/a0bed2fb79
-rw-r--r-- | lib/bundler/definition.rb | 6 | ||||
-rw-r--r-- | spec/bundler/install/yanked_spec.rb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 0580860845..8f43befe35 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -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? diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb index b53c15be69..3acae85afd 100644 --- a/spec/bundler/install/yanked_spec.rb +++ b/spec/bundler/install/yanked_spec.rb @@ -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.") |