Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
fix GemNotFound message in Resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
sealocal authored and indirect committed Apr 14, 2015
1 parent 7de2a4b commit dc442f4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/bundler/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ def local_search(query, base = nil)
end
end

def source_types
sources.map{|s| s.class }.uniq
end

alias [] search

def <<(spec)
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ def verify_gemfile_dependencies_are_found!(requirements)
end
else
message = "Could not find gem '#{requirement}' "
if @index.source_types.include?(Bundler::Source::Rubygems)
message << "in any of the gem sources listed in your Gemfile."
if Bundler.definition.has_rubygems_remotes?
message << "in any of the gem sources listed in your Gemfile or installed on this machine."
else
message << "in the gems available on this machine."
end
Expand Down
16 changes: 16 additions & 0 deletions spec/install/post_bundle_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@
expect(out).to include(bundle_complete_message)
end
end

describe "with misspelled or non-existent gem name" do
before :each do
gemfile <<-G
source 'https://rubygems.org/'
gem "rails"
gem "misspelled-gem-name", :group => :development
G
end

it "should report a helpufl error message" do
bundle :install
expect(out).to include("Fetching gem metadata from https://rubygems.org/")
expect(out).to include("Could not find gem 'misspelled-gem-name (>= 0) ruby' in any of the gem sources listed in your Gemfile or installed on this machine.")
end
end
end

describe "for second bundle install run" do
Expand Down

0 comments on commit dc442f4

Please sign in to comment.