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

[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
This commit is contained in:
David Rodríguez 2021-07-31 12:57:57 +02:00 committed by Hiroshi SHIBATA
parent f1c0729128
commit b17cdad2f8
Notes: git 2021-08-31 19:07:21 +09:00
4 changed files with 1 additions and 8 deletions

View file

@ -273,11 +273,7 @@ module Bundler
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 << 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?
"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
else else
message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \ message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
"listed in your Gemfile#{cache_message}." "listed in your Gemfile#{cache_message}."

View file

@ -121,7 +121,6 @@ RSpec.describe "post bundle message" do
G G
expect(err).to include <<-EOS.strip expect(err).to include <<-EOS.strip
Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally. 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 EOS
end end

View file

@ -347,7 +347,6 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "fails" do it "fails" do
bundle :install, :artifice => "compact_index", :raise_on_error => false 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("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
end end

View file

@ -1960,7 +1960,6 @@ class TestGem < Gem::TestCase
expected = <<-EXPECTED expected = <<-EXPECTED
Could not find gem 'a' in locally installed gems. 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 You may need to `gem install -g` to install missing gems
EXPECTED EXPECTED