varatis
varatis

Reputation: 14750

Get rid of Guard bundler warning

How can I get rid of this warning (permanently)

Guard here! It looks like your project has a Gemfile, yet you are running
     `guard` outside of Bundler. If this is your intent, feel free to ignore this
     message. Otherwise, consider using `bundle exec guard` to ensure your
     dependencies are loaded correctly.

...without having to run bundle exec guard every time I launch it? I've worked on teams with more experienced test developers who've managed to get rid of this warning before, but I can't seem to figure it out.

Upvotes: 2

Views: 1103

Answers (1)

Netzpirat
Netzpirat

Reputation: 5501

Guard checks if your current working directory contains a Gemfile and shows you the Bundler warning you want to get rid of. This warning has been added, because a lot of issues have been filed at the Guard issue tracker that are caused by a wrong LOAD_PATH, and running Guard with Bundler solves most of them.

If you use Guard in a project with a Gemfile, you should keep running Guard with Bundler, by either prefix Guard with bundle exec or use some binstub solution. I'm using a simple alias in my ZSH config alias be=bundle exec and I start Guard with be guard. If you prefer a binstub solution, I recommend to use Rubygems bundler:

gem install rubygems-bundler
gem regenerate_binstubs

If you know what you're doing and don't want to see this message, you can use the --no-bundler-warning (or the short version -B). If you never, ever want to see this message again, create an alias alias guard=guard -B.

Upvotes: 4

Related Questions