From b17cdad2f803520ed472605cc8ef7a5350f095f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 31 Jul 2021 12:57:57 +0200 Subject: [rubygems/rubygems] Remove redundant part of error message It doesn't really add much, in my opinion. We want to be helpful, but also concise when possible. https://github.com/rubygems/rubygems/commit/9d56009cf7 --- lib/bundler/resolver.rb | 6 +----- spec/bundler/commands/post_bundle_message_spec.rb | 1 - spec/bundler/install/gemfile/sources_spec.rb | 1 - test/rubygems/test_gem.rb | 1 - 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index a78b2db157..d19dc3e6f3 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -273,11 +273,7 @@ module Bundler specs = source.specs.search(name) 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 << if versions_with_platforms.any? - "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" - else - "The source does not contain any versions of '#{name}'" - end + 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}." diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 72f8020b44..3050b87754 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -121,7 +121,6 @@ RSpec.describe "post bundle message" do G expect(err).to include <<-EOS.strip Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally. -The source does not contain any versions of 'not-a-gem' EOS end diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 8c225afb11..72d05aa80e 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -347,7 +347,6 @@ RSpec.describe "bundle install with gems on multiple sources" do it "fails" do bundle :install, :artifice => "compact_index", :raise_on_error => false expect(err).to include("Could not find gem 'private_gem_1' in rubygems repository https://gem.repo2/ or installed locally.") - expect(err).to include("The source does not contain any versions of 'private_gem_1'") end end diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 79ea89e2fa..12612bd759 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1960,7 +1960,6 @@ class TestGem < Gem::TestCase expected = <<-EXPECTED Could not find gem 'a' in locally installed gems. -The source does not contain any versions of 'a' You may need to `gem install -g` to install missing gems EXPECTED -- cgit v1.2.3