I'm developing a custom engine using this setup.
I've created the engine with
rails plugin new MyEngine --full
Then I've added rspec-rails
and guard-rspec
as development dependencies with
s.add_development_dependency "rspec-rails"
s.add_development_dependency "guard-rspec"
in my gemspec file.
When I run both rspec
and rake spec
(with or without bundle exec
) my specs run fine. When I run the guard
command however it runs all the specs for the first time and then it does not do nothing. It won't detect any file change in the whole app.
The Guardfile is generated as usual with guard init spec
, here is its content
# 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
If I keep a shell open with guard running and I do from another shell touch app/my_model.rb
nothing happens. The same for every other file(pattern) listed in the Guardfile.
Is there any way to debug this kind of issues?
Update
I've created a new project (a rails one) and installed the guard-shell gem with this Guardfile
guard 'shell' do
watch(%r{(.*)}) {|m| `cat #{m[0]}` }
watch(%r{(.*)}) {|m| raise m.to_s }
end
Even in this case if I edit any files nothing happens. I'm starting to think that the problem could be somewhere else, maybe in the rb-fsevents
gem. What can I check?