summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Arko <andre@arko.net>2016-02-08 12:24:41 +1100
committerAndré Arko <andre@arko.net>2016-02-08 12:24:41 +1100
commita753d0182e6d4d91d7e401e40482c6cec5baadae (patch)
tree6c73290bf6c0c1e06fdc05dc575f06114efdc806
parent8b18c86b22e3f910257dd39fbb34b583529559ef (diff)
parentcb29f676c16cb2eab36b7dc3f22caea0754f9e74 (diff)
downloadbundler-a753d0182e6d4d91d7e401e40482c6cec5baadae.tar.gz
Merge pull request #4283 from RochesterinNYC/improve-error-message-invalid-gemspec-for-dependency
Add helpful invalid gemspec error message for `bundle install --standalone`
-rw-r--r--lib/bundler/installer/standalone.rb3
-rw-r--r--spec/install/gems/standalone_spec.rb14
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index 69cfbfc455..41fe207756 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -44,6 +44,9 @@ module Bundler
def gem_path(path, spec)
full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
+ rescue TypeError
+ error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
+ raise Gem::InvalidSpecificationException.new(error_message)
end
end
end
diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb
index d0f5af709f..a74e9175d1 100644
--- a/spec/install/gems/standalone_spec.rb
+++ b/spec/install/gems/standalone_spec.rb
@@ -303,4 +303,18 @@ describe "bundle install --standalone" do
expect(extension_line).to eq "$:.unshift File.expand_path '../../bundle', __FILE__"
end
end
+
+ describe "with gem that has an invalid gemspec" do
+ before do
+ install_gemfile <<-G, :standalone => true
+ source 'https://rubygems.org'
+ gem "resque-scheduler", "2.2.0"
+ G
+ end
+
+ it "outputs a helpful error message" do
+ expect(out).to include("You have one or more invalid gemspecs that need to be fixed.")
+ expect(out).to include("resque-scheduler 2.2.0 has an invalid gemspec")
+ end
+ end
end