Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Warn if Guard isn't launched with `bundle exec` #223

Closed
thibaudgg opened this Issue Jan 9, 2012 · 11 comments

Comments

Projects
None yet
4 participants
Owner

thibaudgg commented Jan 9, 2012

We should add a warning message (or even refuse to launch Guard!) if a Gemfile is present and bundle exec isn't used.

We can maybe doing it like that (http://stackoverflow.com/questions/6542432/how-to-raise-error-if-cap-deploy-was-not-invoked-using-bundle-exec).
We just need to be careful if the rubygems-bundler gem is installed/used.

This would be a nice addition before the 1.0.0 release! :)

Contributor

netzpirat commented Jan 9, 2012

That would save us hours in 2012! Perhaps we can also use Bundler.setup if not running with Bundler.

Owner

rymai commented Jan 9, 2012

Good idea but not sure rubygems-bundler is a problem, in the end the ENV['BUNDLE_BIN_PATH'] or ENV['BUNDLE_GEMFILE'] are set if Guard is run by bundler so we can safely rely on the presence of these variables, or not?

Owner

thibaudgg commented Jan 9, 2012

We need to check that, no idea how it works.

Contributor

netzpirat commented Jan 16, 2012

Just did a quick test with ENV['BUNDLE_GEMFILE'] and it works fine. Do we wanna show this as an error or info message, or should we add a new message type UI#warning? Also, do we check for bundler presence for all actions or only when actually start Guard?

Owner

thibaudgg commented Jan 16, 2012

I think warning would be a good fit here, something like:

WARNING: You are using Guard outside of Bundler, this is dangerous and could not work. Using "bundle exec guard" is safer.

I would add this warning to all actions, to safe us a little more hours in 2012. :)

@netzpirat netzpirat closed this Jan 16, 2012

Owner

thibaudgg commented Jan 16, 2012

Awesome thanks!

Hi, I'm using Isolate instead of Bundler and still see this warning. So, as I see it doesn't check if you use Bundler at all

Owner

thibaudgg commented Apr 30, 2012

@semaperepelitsa We're checking for a Gemfile and the non-presence of ENV['BUNDLE_GEMFILE'] https://github.com/guard/guard/blob/master/lib/guard/cli.rb#L161

Good, will be waiting for a release.

Owner

thibaudgg commented Apr 30, 2012

@semaperepelitsa I just released version 1.0.2, please tell me if it works for you.

Yep, it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment