guard / guard-bundler

Guard::Bundler automatically install/update your gem bundle when needed
https://rubygems.org/gems/guard-bundler
MIT License
117 stars 22 forks source link

Advice to use bundle exec incompatible with guard-bundler #9

Closed guyboltonking closed 12 years ago

guyboltonking commented 12 years ago

(I'm raising this because I haven't found an explicit solution to this issue; the symptoms are those as described in #2 and #3. Commit 61f034ed fixes some of the problem, and this comment in issue #2 is the missing link: use bundle install --binstubs).

Guard Issue #223 introduces a warning asking users to execute guard using bundle exec; however, doing this prevents guard-bundler from working.

The solution is to use bundle install --binstubs, and then execute guard using the stubbed version in bin/guard, at which point everything works as intended.

Why? Using bundle exec guard prevents ::Bundle.with_clean_env from working as intended: with_clean_env restores the environment found when Bundler was loaded, but bundle exec has already set RUBYOPT in the environment when guard loads Bundler, so with_clean_env doesn't remove it.

I think the best solution at this point might be some documentation: shall I update the README?

artm commented 12 years ago

I've been bitten by this as well. Yes, documentation should be updated.

gerrywastaken commented 12 years ago

Was also hit by this issue. Shouldn't the warning added in 223 also be updated to reflect this issue?

yannlugrin commented 12 years ago

Released version 1.0.0 with cli option, if you want upgrade informations in README, please send another pull requests.

THanks for your investigation.

guyboltonking commented 12 years ago

Looks like the core issue of ::Bundle.with_clean_env not clearing out RUBYOPT properly was fixed in Bundler 1.1.0 (see carlhuda/bundler#1604), so there's no need for an updated README, as the advice to use bundle exec is now wholly valid for guard-bundler!