rails / spring-watcher-listen

MIT License
64 stars 35 forks source link

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

Closed alex-grover closed 9 years ago

alex-grover commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

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