【问题标题】:Guard Rspec :cli option is deprecated, change to :cmd optionGuard Rspec :cli 选项已弃用,更改为 :cmd 选项
【发布时间】:2014-01-19 10:03:44
【问题描述】:

在我的 Rails 应用程序中工作 Guardfile

guard 'rspec', all_after_pass: false, cli: '--drb' do

不工作Guardfile

guard 'rspec', all_after_pass: false, cmd: '--drb' do

我已经多次使用bundle exec guard 打开保护,但我发现即使我收到了这条消息 Guard::RSpec DEPRECATION WARNING: The :cli option is deprecated. Please customize the new :cmd option to fit your need. 我进行了适当的更改, :cli 是唯一使用 rspec 的。

: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.

: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)> 

留下:cli 还是有解决办法?

【问题讨论】:

  • 您没有自定义它以满足您的需求 - 您只是将 cli 复制到 cmd 并期望它可以工作
  • 啊,我明白我做错了什么。我会发布答案
  • 我无法发布答案,所以在这里。 :cmd 需要执行一些定制的东西以满足我的需求。正如@sevenseacat 所说,“您没有对其进行自定义以满足您的需求 - 您只是将 cli 复制到 cmd 并期望它能够工作”我正在运行 Spork、Guard 和 Rspec 进行测试。而不是只写--drb 我应该在前面加上rspec Fixed Guardfile has guard 'rspec', all_after_pass: false, cmd: 'rspec --drb' do

标签: ruby-on-rails rspec guard


【解决方案1】:

:cmd 需要执行一些定制的东西以满足我的需要。正如@sevenseacat 所说,“您没有根据自己的需要对其进行自定义 - 您只是将 cli 复制到 cmd 并期望它能够工作”

我正在运行 Spork、Guard 和 Rspec 进行测试。我应该在前面加上 rspec 而不是只写 --drb

固定的Guardfile有

guard 'rspec', all_after_pass: false, cmd: 'rspec --drb' do

【讨论】:

    猜你喜欢
    • 2014-09-21
    • 2013-08-18
    • 2020-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2014-05-27
    相关资源
    最近更新 更多