问题
Working Guardfile
in my rails app
guard 'rspec', all_after_pass: false, cli: '--drb' do
Not working Guardfile
guard 'rspec', all_after_pass: false, cmd: '--drb' do
I've opened guard with bundle exec guard
many times, but I found even though I receive this message
Guard::RSpec DEPRECATION WARNING: The :cli option is deprecated. Please customize the new :cmd option to fit your need.
and I make the proper changes, :cli is the only one working with rspec.
terminal output for :cli
01:49:14 - WARN - Guard::RSpec DEPRECATION WARNING: The :cli option is deprecated. Please customize the new :cmd option to fit your need.
01:49:15 - INFO - Guard is using Growl to send notifications.
01:49:15 - INFO - Guard is using Emacs to send notifications.
01:49:15 - INFO - Guard is using TerminalTitle to send notifications.
01:49:15 - INFO - Starting Spork for RSpec
Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
01:49:17 - INFO - Spork server for RSpec successfully started
01:49:17 - INFO - Guard::RSpec is running
01:49:17 - INFO - Guard is now watching at '/Users/me/rails_projects/mvp'
[1] guard(main)>
01:49:18 - INFO - Run all
01:49:18 - INFO - Running all specs
Running tests with args ["--color", "--failure-exit-code", "2", "--format", "progress", "--format", "Guard::RSpec::Formatter", "--require", "/Users/me/.rvm/gems/ruby-2.1.0@rails40/gems/guard-rspec-4.2.4/lib/guard/rspec/formatter.rb", "spec"]...
......................................................................
Finished in 0.76464 seconds
70 examples, 0 failures
Randomized with seed 47137
Done.
terminal output for :cmd
bundle exec guard
01:58:55 - INFO - Guard is using Growl to send notifications.
01:58:55 - INFO - Guard is using Emacs to send notifications.
01:58:55 - INFO - Guard is using TerminalTitle to send notifications.
01:58:55 - INFO - Starting Spork for RSpec
Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
01:58:57 - INFO - Spork server for RSpec successfully started
01:58:57 - INFO - Guard::RSpec is running
01:58:57 - INFO - Guard is now watching at '/Users/me/rails_projects/mvp'
[1] guard(main)>
01:58:59 - INFO - Run all
01:58:59 - INFO - Running all specs
[2] guard(main)>
Just leave the :cli
or is there a solution?
回答1:
:cmd needs to execute something that is customized to fit my needs. As @sevenseacat said, "You didn't customize it to fit your needs - you just copied the cli to cmd and expected it to work"
I'm running Spork, Guard, and Rspec for testing. Instead of just writing --drb I should prepend it with rspec
Fixed Guardfile has
guard 'rspec', all_after_pass: false, cmd: 'rspec --drb' do
来源:https://stackoverflow.com/questions/21215357/guard-rspec-cli-option-is-deprecated-change-to-cmd-option