2012-07-18 129 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