Skip to content

Commit

Permalink
Merge pull request #4019 from rubygems/improve_error_messages
Browse files Browse the repository at this point in the history
Improve gem not found in source error messages

(cherry picked from commit 3b2471d)
  • Loading branch information
deivid-rodriguez committed Dec 7, 2020
1 parent 073bef7 commit e5a9c8d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/resolver.rb
Expand Up @@ -302,7 +302,7 @@ def verify_gemfile_dependencies_are_found!(requirements)
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 '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
"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
Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/commands/exec_spec.rb
Expand Up @@ -747,7 +747,7 @@ def bin_path(a,b,c)
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
The source contains 'rack' at: 1.0.0\e[0m
The source contains the following versions of 'rack': 1.0.0\e[0m
\e[33mRun `bundle install` to install missing gems.\e[0m
EOS

Expand Down
6 changes: 3 additions & 3 deletions bundler/spec/install/gemfile/git_spec.rb
Expand Up @@ -87,7 +87,7 @@
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G

expect(err).to include("The source contains 'foo' at: 1.0")
expect(err).to include("The source contains the following versions of 'foo': 1.0")
end

it "complains with version and platform if pinned specs don't exist in the git repo" do
Expand All @@ -103,7 +103,7 @@
end
G

expect(err).to include("The source contains 'only_java' at: 1.0 java")
expect(err).to include("The source contains the following versions of 'only_java': 1.0 java")
end

it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do
Expand All @@ -124,7 +124,7 @@
end
G

expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
expect(err).to include("The source contains the following versions of 'only_java': 1.0 java, 1.1 java")
end

it "still works after moving the application directory" do
Expand Down

0 comments on commit e5a9c8d

Please sign in to comment.