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

config/spring.rb watched files not reloading app #2

Closed
alex-grover opened this issue Mar 3, 2015 · 4 comments
Closed

config/spring.rb watched files not reloading app #2

alex-grover opened this issue Mar 3, 2015 · 4 comments

Comments

@alex-grover
Copy link

I am working on this rails issue and the expected behavior of Spring.watch in config/spring.rb doesn't seem to be working for me. In a new rails app (using 4.2.0 on OS X 10.10.2) with spring-watcher-listen added to the Gemfile and config/spring.rb copied directly from the other issue, the config file is loaded and the files are added to the watcher BEFORE the default files are in https://github.com/rails/spring/blob/master/lib/spring/application.rb#L105-L112 at which time printing watcher.files shows all the files, including the ones added in config/spring.rb.

However, spring only reloads the app when the files added to the watcher in application.rb are changed. Changing the other files seems to not do anything at all. Using Spring.watch_method = :poller, the expected behavior happens so this seems to me to be an issue with this gem. Any ideas why this is happening? I am relatively new to ruby/rails so I am not sure if this is a bug or operator error.

@e2
Copy link
Contributor

e2 commented Mar 3, 2015

I never got to implementing support for Listen 2.0 (see: #1), so probably only polling works.

I'd probably need to find some spare time to do this (won't happen soon unless a lot of people need this -
personally I use Zeus instead of Spring).

Newer versions of Listen have detailed debugging facilities, so you can check if it's not a Listen related issue (see https://github.com/guard/listen/wiki#issues-and-troubleshooting).

@alex-grover
Copy link
Author

Got it. However, is there a reason that :listen works for the default files added in application.rb? I'll just use polling for now but I am interested to figure out why it works in some cases but not others.

@e2
Copy link
Contributor

e2 commented Mar 4, 2015

@ajgrover - check the troubleshooting section I mentioned above - the LISTEN_GEM_DEBUGGING will help you see which events Listen is watching or ignoring.

Also, Listen watches directories, not files - so you'll want to check which directories are being watched, which files are being ignored, and which ones Spring is treating as relevant.

@alex-grover
Copy link
Author

I figured it out - the Listen gem ignores tmp/ by default (which isn't made clear in the docs). Thanks for your help!

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