我正在使用this setup開發定製引擎。Guard沒有看到文件更新
我已經在我的gemspec文件創建了
rails plugin new MyEngine --full
然後我添加rspec-rails
和guard-rspec
的發展依賴發動機與
s.add_development_dependency "rspec-rails"
s.add_development_dependency "guard-rspec"
。
當我運行rspec
和rake spec
(有或沒有bundle exec
)我的規格運行良好。當我運行guard
命令但是它第一次運行所有規格,然後它什麼都不做。它不會在整個應用程序中檢測到任何文件更改。
的Guardfile照常產生與guard init spec
,這裏是它的內容
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'rspec', :version => 2 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{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_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('spec/spec_helper.rb') { "spec/" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
如果我保持外殼帶防護運行開放,我從另一個shell touch app/my_model.rb
什麼也沒有發生事情。 Guardfile中列出的每個其他文件(模式)都相同。
有什麼辦法可以調試這類問題嗎?
更新 我創建了一個新的項目(一軌之一),與此Guardfile
guard 'shell' do
watch(%r{(.*)}) {|m| `cat #{m[0]}` }
watch(%r{(.*)}) {|m| raise m.to_s }
end
安裝guard-shell寶石即使在這種情況下,如果我修改什麼也不會發生任何文件。我開始認爲問題可能在其他地方,也許在rb-fsevents
寶石。我可以檢查什麼?
你說得對,我會更新(默認)生成的文件。但這不是問題。看到我的編輯問題。 – Fabio
啊我看到了......你可以用一個--debug標誌跑衛,但我認爲你可能已經嘗試過了。 – numbers1311407
是的,我試過了,thx。我剛剛解決了系統重新啓動,請參閱[我的答案](http://stackoverflow.com/questions/7311405/guard-doesnt-see-file-updates/7312249#7312249)。 – Fabio