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

Commit

Permalink
Merge pull request #4283 from RochesterinNYC/improve-error-message-in…
Browse files Browse the repository at this point in the history
…valid-gemspec-for-dependency

Add helpful invalid gemspec error message for `bundle install --standalone`
  • Loading branch information
indirect committed Feb 8, 2016
2 parents 8b18c86 + cb29f67 commit a753d01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bundler/installer/standalone.rb
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
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"

This comment has been minimized.

Copy link
@glennpratt

glennpratt Mar 15, 2016

Contributor

Are we using live rubygems intentionally here? I noticed this test failing or being slow.

I tried to make this a fake invalid gem with build_gem and failed 😄.

This comment has been minimized.

Copy link
@indirect

indirect Mar 15, 2016

Author Member

whaaaat noooooo live rubygems specs have to be tagged "realworld" and live in a different place. this seems really bad 😬

This comment has been minimized.

Copy link
@glennpratt

glennpratt Mar 15, 2016

Contributor

I'll add :realworld to the PR I'm working on.

This comment has been minimized.

Copy link
@RochesterinNYC

RochesterinNYC Mar 15, 2016

Contributor

That's my bad. I added this spec a while back. Made it point to actual rubygems/the actual gem because of the difficulty in simulating it. I can take another look at simulating it and in worst case moving it to the realworld specs.

This comment has been minimized.

Copy link
@glennpratt

glennpratt Mar 15, 2016

Contributor

@RochesterinNYC added :realworld here #4274

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

0 comments on commit a753d01

Please sign in to comment.