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

Add helpful invalid gemspec error message for bundle install --standalone #4283

Merged
merged 1 commit into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/bundler/installer/standalone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def bundler_path
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
14 changes: 14 additions & 0 deletions spec/install/gems/standalone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,18 @@
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