Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems to hang and never start #132

Open
andrewhavens opened this issue Jan 13, 2015 · 4 comments
Open

Seems to hang and never start #132

andrewhavens opened this issue Jan 13, 2015 · 4 comments

Comments

@andrewhavens
Copy link

andrewhavens commented Jan 13, 2015

In the process of upgrading my gems to the latest versions, I have encountered a situation where spork never seems to stop launching. Here is the output that I get:

$ bundle exec guard
23:22:55 - INFO - Starting Spork for RSpec, Cucumber
Using Cucumber, Rails
Using RSpec, Rails
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block...
Loading Spork.prefork block...
Spork is ready and listening on 8990!
Spork is ready and listening on 8989!
23:23:06 - INFO - Spork server for RSpec, Cucumber successfully started

If I hit Control+C it continues, some warning messages appear, and it looks like spork never started:

23:23:06 - INFO - Spork server for RSpec, Cucumber successfully started
^C

23:32:18 - INFO - Guard::RSpec is running
        ** ERROR: directory is already being watched! **

        Directory: /path/to/app/views/sub/sub/other/file

        is already begin watched through: /path/to/app/views/sub/sub/symlink_to_other_file

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors

When I remove the spork config from my Guardfile (and change rspec and cucumber to not pass --drb flag), it starts up right away.

@andrewhavens
Copy link
Author

My original Guardfile looks like this:

guard :spork, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
  watch('config/application.rb')
  watch('config/environment.rb')
  watch('config/environments/test.rb')
  watch(%r{^config/initializers/.+\.rb$})
  watch('Gemfile.lock')
  watch('spec/spec_helper.rb') { :rspec }
  watch('test/test_helper.rb') { :test_unit }
  watch(%r{features/support/}) { :cucumber }
end

guard :rspec, all_on_start: false, all_after_pass: false, failed_mode: :focus, cmd: "bundle exec rspec --drb" do
  require "guard/rspec/dsl"
  dsl = Guard::RSpec::Dsl.new(self)

  # RSpec files
  rspec = dsl.rspec
  watch(rspec.spec_helper) { rspec.spec_dir }
  watch(rspec.spec_support) { rspec.spec_dir }
  watch(rspec.spec_files)

  # Ruby files
  ruby = dsl.ruby
  dsl.watch_spec_files_for(ruby.lib_files)

  # Rails files
  rails = dsl.rails(view_extensions: %w(erb haml slim))
  dsl.watch_spec_files_for(rails.app_files)
  dsl.watch_spec_files_for(rails.views)

  watch(rails.controllers) do |m|
    [
      rspec.spec.("routing/#{m[1]}_routing"),
      rspec.spec.("controllers/#{m[1]}_controller"),
      rspec.spec.("acceptance/#{m[1]}")
    ]
  end

  # Rails config changes
  watch(rails.spec_helper)     { rspec.spec_dir }
  watch(rails.routes)          { "#{rspec.spec_dir}/routing" }
  watch(rails.app_controller)  { "#{rspec.spec_dir}/controllers" }

  # Capybara features specs
  watch(rails.view_dirs)     { |m| rspec.spec.("features/#{m[1]}") }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
  end
end

guard "cucumber", all_on_start: false, all_after_pass: false, focus_on: "focus", cli: "--drb --no-profile --color --strict", change_format: "pretty" do
  watch(%r{^features/.+\.feature$})
  watch(%r{^features/support/.+$})          { "features" }

  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || "features"
  end
end

@nathanielks
Copy link

I've got the same problem @andrewhavens, though I'm not using cucumber. Did you ever resolve this?

@andrewhavens
Copy link
Author

@nathanielks Can't remember if I fixed it, but looking at the error again, I realized that the "already being watched" error was because I had symlinked files. Guard didn't like my symlinks!

@nathanielks
Copy link

Ah, glad you figured that out! Thanks for replying so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants