Guard-rspec and ember don't work well together

Rails 4.2.7 guard-rspec 4.7.3

Since I installed ember-cli-rails, the ember application prevents the security specification from starting and causes hundreds of errors. Here is one mistake:

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 several things in the guard file, even deleting all the hours:

 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 tried several versions of ignore, but it still doesn't work.

The problem basically lies in the fact that using the tmp ember folder to create a preview application makes the guard go crazy. And it seems that watchdog ignore does not protect this folder, but still scans it.

How to make protection file ignore ember folder so that I can restore rspec-guard?

EDIT

I edited the protection file as follows:

 guard 'rspec',:cli => "--drb --format progress",all_after_pass: false do ignore(%r{^marketadmin/(.+)}) end 

It still fails with the following error (there are so many errors that 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 
+5
source share
1 answer

As I wrote in the IRC channel, I did not quite understand which subfolder are you trying to avoid?

if I add a guard to the top of the ignore(%r{frontend/(.+)}) statements ignore(%r{frontend/(.+)}) or ignore(%r{marketadmin/(.+)}) in my file, it will quite successfully ignore everything that happens in the frontend application.

My Guard file looks like this:

 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 use, maybe the problem is that there was a configuration?

A useful command might be:

 LISTEN_GEM_DEBUGGING=2 bundle exec guard -d 

Hope this helps. Hooray!

Update. Checked the errors that you see, and start looking at them in my mock setting after installing broccolli-funnel , which creates symbolic links, and the listener stone that the guards encounter seems to have problems with them, that I don’t have time today analyze deeper ... Perhaps you can try the installation using ember from rails.

+2
source

Source: https://habr.com/ru/post/1270746/


All Articles