2012-07-18 86 views
2

我怎样才能摆脱这种警告(永久)的摆脱后卫捆绑警告

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. 

的...而无需运行bundle exec guard我每次启动它的时间?我曾与更多经验丰富的测试开发人员合作,他们之前设法摆脱了此警告,但我似乎无法弄清楚。

回答

4

Guard会检查您的当前工​​作目录是否包含Gemfile并向您显示您想摆脱的Bundler警告。此警告已被添加,因为在Guard问题跟踪器中存在很多问题,这些问题是由错误的LOAD_PATH引起的,运行Guard with Bundler解决了其中的大多数问题。

如果在具有Gemfile的项目中使用Guard,则应该继续使用Bundler运行Guard,或者使用前缀Guard或bundle exec或使用一些binstub解决方案。我在ZSH配置alias be=bundle exec中使用了一个简单的别名,我用be guard启动Guard。如果你喜欢一个binstub解决方案,我建议使用Rubygems bundler

gem install rubygems-bundler 
gem regenerate_binstubs 

如果你知道你在做什么,也不想看到这条消息,你可以使用--no-bundler-warning(或短版-B) 。如果你永远不想再看到此消息,请创建一个别名alias guard=guard -B

+0

宝石解决方案是一个有趣的 – ecoologic 2012-07-19 10:27:21