每当我尝试在Windows上将wdm与guard结合使用时,guard都会静默退出。但是,如果我强制轮询,那么guard就能正常工作。可能说明这一点的最好方法是用一个例子。这是我使用wdm运行guard时发生的情况:
C:/path/to/code>bundle exec guard init rspec
11:47:02 - INFO - rspec guard added to Guardfile, feel free to edit it
C:/path/to/code>bundle exec guard
11:48:06 - INFO - Guard is using TerminalTitle to send notifications.
11:48:06 - INFO - Guard::RSpec is running
11:48:06 - INFO - Guard is now watching at 'C:/path/to/code'
C:/path/to/code>但是,如果我强制guard轮询更改,那么它将通过在guard控制台结束而正确运行:
C:/path/to/code>bundle exec guard -p
11:50:03 - INFO - Guard is using TerminalTitle to send notifications.
11:50:03 - INFO - Guard::RSpec is running
11:50:03 - INFO - Guard is now watching at 'C:/path/to/code'
[1] guard(main)>我希望有人能对这个问题有所了解。我已经尝试了相当多的搜索,但没有能够找到这个问题的任何答案。
来自我的Gemfile的相关摘录:
source 'http://rubygems.org'
ruby '1.9.3'
require "rbconfig"
gem 'rails', '3.2.13'
gem "figaro", ">= 0.5.3"
gem "rspec-rails", ">= 2.12.2", :group => [:development, :test]
gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test]
group :test do
gem "capybara", ">= 2.0.2"
gem "database_cleaner", ">= 0.9.1"
gem "email_spec", ">= 1.4.0"
gem "guard-rspec"
gem "wdm", ">= 0.1.0" if RbConfig::CONFIG["target_os"] =~ /mswin|mingw|cygwin/i
end我的Guardfile:
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :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" }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
# 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发布于 2014-07-19 20:42:02
我对此没有答案,但我想我可能会收集一些与此相关的问题。
主要问题是listen gem中的Problems on Windows。
在guard上有一个相关的问题是Guard 2.0.3 daemon doesn't stay running on windows,它被关闭以支持listen问题。
wdm gem还有一个公开的问题:fail with listen gem。
很抱歉我不能解决这个问题,但至少这个问题还在继续。少数在Ruby for Windows上工作的人就是这样的天才!我为这个双关语道歉:)
https://stackoverflow.com/questions/20862629
复制相似问题