Information on what gem bundler has started to install, to ease debugging #1380

Merged
merged 3 commits into from Sep 13, 2011

2 participants

@rwilcox

When something goes wrong with a gem bundler currently gives output like this:

....

Installing somegem
Undefined some_method for NilClass

A user might believe that the problem happened when trying to install somegem, and blame the issue on bundler when "gem install somegem" is successful.

In fact, what has happened is Bundler has successfully installed somegem, but has failed on the next gem in the list. However, figuring out the next gem in the list is non-trivial for a non Bundler developer to figure out.

This pull outputs the following line before starting processing on the current gem.

Thus, the output from the failure above would look like:

  Currently processing 'somegem'...
Installing somegem

  Currently processing 'bad_gem'
Undefined some_method for NilClass

With this change a user can identify that 'bad_gem' is the gem with errors, and try to 'gem install bad_gem' (to see if the error is bundler specific, or something with the gem / Rubygems)

@indirect
Bundler member
@rwilcox

I moved the debugging information into a rescue statement and pushed the commit to my branch. What do you think now?

@indirect indirect commented on an outdated diff Sep 5, 2011
lib/bundler/installer.rb
- Bundler.ui.info ""
- generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
- FileUtils.rm_rf(Bundler.tmp)
+ Bundler.ui.info ""
+ generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
+ FileUtils.rm_rf(Bundler.tmp)
+ rescue Exception
+ puts "Error: '#{$!.message}', when installing #{spec.name}"
@indirect
Bundler member
indirect added a line comment Sep 5, 2011

This should use the Bundler UI classes, maybe something more like

rescue => e
  Bundler.ui.warn "#{e.class}: #{e.message}"
  Bundler.ui.error "An error occurred while installing gem #{spec.name} (#{spec.version}), and Bundler cannot continue."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@indirect
Bundler member

As soon as the error messaging is fixed, this looks good. Thanks!

@rwilcox

Latest commit uses the UI methods, and has slightly better wording (based on your suggestions)!

Let me know if there's anything else I can do!

@indirect indirect merged commit 82ac6b6 into bundler:1-0-stable Sep 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment