警卫开始然后退出?

时间:2013-05-12 07:13:58

标签: guard

我想用警卫来进行我的培根测试,我的Gemfile看起来像是:

source 'https://rubygems.org'

gem 'sinatra'
gem 'sidekiq'
gem 'slim'
gem 'puma'
gem 'nokogiri'
gem 'httparty'

group :test, :development do
  gem 'guard'
  gem 'bacon'
  gem 'guard-bacon'
  gem 'libnotify'
  gem 'rb-inotify'
end

我的Guardfile看起来像

# parameters:
#  output     => the formatted to use
#  backtrace  => number of lines, nil =  everything
guard 'bacon', :output => "BetterOutput", :backtrace => 4 do
  watch(%r{^lib/(.+)\.rb$})     { |m| "specs/lib/#{m[1]}_spec.rb" }
  watch(%r{specs/.+\.rb$})
end

当我运行guard时,会发生以下情况

$ guard
Bacon: Using output BetterOutput.
Bacon: Limiting backtrace to 4 lines.
09:02:05 - INFO - Guard uses Libnotify to send notifications.
09:02:05 - INFO - Guard uses TerminalTitle to send notifications.
09:02:05 - INFO - Guard is now watching at '/home/martin/code/jse-api'
Guard::Bacon started.
[1] guard(main)> %                     
$

它似乎加载了一切,进入警卫提示并退出。

我不知道为什么?

1 个答案:

答案 0 :(得分:0)

问题似乎是guard

所要求的guard-bacon 1.1.0版本

如果你强制使用最新版本的后卫

gem 'guard', '>= 1.8.0'

它回退到guard-bacon 1.0.5的旧版本,一切正常。