Rails 4.2.7 guard-rspec 4.7.3
Since I installed ember-cli-rails, the ember app prevent guard-spec to run and triggers hundreds of errors. Here is one error :
Directory: /home/sylvain/dev/placedemarche/marketadmin/tmp/broccoli_merge_trees-output_path-rlX3b4rm.tmp/marketadmin/tests/unit
is already being watched through: /home/sylvain/dev/placedemarche/marketadmin/tmp/broccoli_persistent_filterbabel__babel_marketadmin-output_path-Nv8C3Z67.tmp/marketadmin/tests/unit
MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
** ERROR: directory is already being watched! **
I tried multiple things in the guardfile, even removing all of the watch :
guard 'rspec',:cli => "--drb --format progress",all_after_pass: false do
# ignore /marketadmin/
# watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_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)$}) { |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 request specs
# watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
I have tried multiple version of ignore, but it still fail.
The problem is basically that the tmp folder ember use to generate the preview app make guard go crazy. And it seems the guard ignore does not really make guard avoid the folder, it still scans it.
How can I make the guard file ignore the ember folder so that I can restore rspec-guard ?
EDIT
I have edited the guardfile as following :
guard 'rspec',:cli => "--drb --format progress",all_after_pass: false do
ignore(%r{^marketadmin/(.+)})
end
It still fails with the following error (there is so many errors i had to set the terminal memory to 30 000 lines, 20 000 was not enough) :
18:24:39 - INFO - Guard::RSpec is running
18:24:39 - DEBUG - Hook :start_end executed for Guard::RSpec
D, [2017-08-24T18:25:00.166155 #20128] DEBUG -- : Waiting for processing to start...
18:25:00 - INFO - Guard is now watching at '/home/sylvain/dev/placedemarche'
18:25:00 - DEBUG - Start interactor
** ERROR: directory is already being watched! **
Directory: /home/sylvain/dev/placedemarche/marketadmin/tmp/funnel-input_base_path-WVhWKrYs.tmp
is already being watched through: /home/sylvain/dev/placedemarche/marketadmin/node_modules/qunit-notifications
MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
** ERROR: directory is already being watched! **
Directory: /home/sylvain/dev/placedemarche/marketadmin/tmp/funnel-input_base_path-ULeE6XMF.tmp
is already being watched through: /home/sylvain/dev/placedemarche/marketadmin/app
MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
As I wrote in the IRC channel I didn't quite get, which subfolder you are trying to avoid ?
if I add to my guardfile at the top of the statements ignore(%r{frontend/(.+)})
, or in your case ignore(%r{marketadmin/(.+)})
it is quite successfully ignoring anything that happens in the frontend app.
My Guardfile looks like :
guard :rspec, cmd: "bundle exec rspec" do
require "guard/rspec/dsl"
dsl = Guard::RSpec::Dsl.new(self)
# Feel free to open issues for suggestions and improvements
ignore(%r{frontend/(.+)})
# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
...
I have no experience with ember, and this broccoli thing that you are using , maybe the the problem is the configuration done there?
A helpful command can be:
LISTEN_GEM_DEBUGGING=2 bundle exec guard -d
Hope the above helps. Cheers!
Update: Checked the errors you are seeing, and start seeing those on my mock
setup, after installing the broccolli-funnel
, which creates symlinks, and the listener gem that guard uses seem to have problems with them, which I don't have the time unfortunately today to analyze deeper...
Maybe you can try a setup with ember being out of the rails dir.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With