File System Monitoring in Rails 5

Hi

When we started rails server with Rails 5, we’ll start fsevent_watch to watch for changes in our application directory. My questions are:

  • Why are we also watching for the locale directory for the loaded gems?

  • Why can’t we just watch the top level directory instead of watching the subdirectories too?

Related ps:

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/locale

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activemodel-5.0.2/lib/active_model/locale

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.2/lib/active_record/locale

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/actionview-5.0.2/lib/action_view/locale

fsevent_watch --latency 0.1 /Users/me/Temp/wat/config/locales

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/web-console-3.4.0/lib/web_console/locales

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/actioncable-5.0.2

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/coffee-rails-4.2.1

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/jquery-rails-4.2.2

fsevent_watch --latency 0.1 /Users/me/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/turbolinks-5.0.1

fsevent_watch --latency 0.1 /Users/me/Temp/wat/db

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/channels

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/controllers

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/helpers

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/jobs

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/mailers

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/models

fsevent_watch --latency 0.1 /Users/me/Temp/wat/test/mailers

fsevent_watch --latency 0.1 /Users/me/Temp/wat/app/assets

``

Thanks in advance.

Hi

When we started rails server with Rails 5, we'll start fsevent_watch to watch for changes in our application directory. My questions are:

* Why are we also watching for the locale directory for the loaded gems?

I suspect something is automatically adding anything from the I18n load path to the list of watchable directories without checking whether they are part of a gem or not.

* Why can't we just watch the top level directory instead of watching the subdirectories too?

If you did that you would receive more notifications, for example the log folder, the tmp folder and so on (although I don't know what the tradeoff is between this vs monitoring a larger number of paths). You might also want to reload code outside of the application top level folder (such as a gem containing an engine that you are developing concurrently with the application)

Fred

My question is mainly whether this is a feature or a bug. I’m just trying to understand how Rails works because the output that I shown was from default rails installation.

If you did that you would receive more notifications, for example the log folder, the tmp folder and so on (although I don’t know what the tradeoff is between this vs monitoring a larger number of paths). You might also want to reload code outside of the application top level folder (such as a gem containing an engine that you are developing concurrently with the application)

I’m not talking about watching the main rails root directory. More like watching /wat/app which should reduce the number of processes that rails needs to start.