guard/guard-bundler — Issue #9: Advice to use bundle exec incompatible with guard-bundler
Author: guyboltonking
Created: 2012-03-01 13:18:30+00:00
State: open

(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](https://github.com/guard/guard-bundler/issues/2#issuecomment-1158346) in issue #2 is the missing link: use `bundle install --binstubs`).

[Guard Issue #223](https://github.com/guard/guard/issues/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?