diff options
-rw-r--r-- | lib/bundler/resolver.rb | 17 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 10 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 55a96ebf44..f29887de0a 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -148,8 +148,23 @@ module Bundler if matching_versions.empty? if current.required_by.empty? + if current.source + name = current.name + versions = @source_requirements[name][name].map { |s| s.version } + message = "Could not find gem '#{current}' in #{current.source}.\n" + if versions.any? + message << "Source contains '#{current.name}' at: #{versions.join(', ')}" + else + message << "Source does not contain any versions of '#{current}'" + end + + raise GemNotFound, message + else + raise GemNotFound, "Could not find gem '#{current}' in any of the sources." + end location = current.source ? current.source.to_s : "any of the sources" - raise GemNotFound, "Could not find gem '#{current}' in #{location}" + raise GemNotFound, "Could not find gem '#{current}' in #{location}.\n" \ + "Source contains fo" else @errors[current.name] = [nil, current] end diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 07b041108d..fa709951d7 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -48,6 +48,16 @@ describe "gemfile install with git sources" do bundle "exec foobar" out.should == "1.0" end + + it "complains if pinned specs don't exist in the git repo" do + build_git "foo" + + install_gemfile <<-G + gem "foo", "1.1", :git => "#{lib_path('foo-1.0')}" + G + + out.should include("Source contains 'foo' at: 1.0") + end end describe "when specifying a revision" do |