summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-02-05 22:36:45 -0800
committerCarl Lerche <carllerche@mac.com>2010-02-05 22:36:45 -0800
commit2b2d3f2dd229d9ea5c2220199c3858377a4f5d61 (patch)
treee68fa00d5cfc5be48719dc49c0cdbac342485367
parent92847ecb4165b62b78eb9bdbcc23e5d0a43566d3 (diff)
downloadbundler-2b2d3f2dd229d9ea5c2220199c3858377a4f5d61.tar.gz
Output a better error if a pinned dependency does not actually contain the requested gem in the source.0.9.3
-rw-r--r--lib/bundler/resolver.rb17
-rw-r--r--spec/install/git_spec.rb10
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