我尝试使用Spring gem运行Guard。
Spring在控制台上运行良好,我希望Guard使用cmd: 'spring rspec'
,但Guard似乎并不关心cmd:
中的Guardfile
参数:
guard :rspec, cmd: 'blaaaa' do
这不会导致错误,所以我认为它只是省略了。我该怎么调试呢?
的Gemfile:
group :development do
gem 'spring'
gem 'spring-commands-rspec' # Commands for RSpec
gem 'listen', '~> 1.0'
gem 'guard-rspec', require: false # Automatically run tests
end
Guardfile:
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :rspec, cmd: 'spring rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
答案 0 :(得分:0)
从guard-rspec版本4.0开始,您可以使用“cmd”选项。警卫似乎误解了错误,但如果您尝试使用:
.. cmd: 'echo spring spec'
然后重启后卫,您将看到命令回显到您的终端。我可以确认卫兵在春季运作良好。