Skip to content

Commit

Permalink
Remove spring-watcher-listen from default Gemfile
Browse files Browse the repository at this point in the history
`spring-watcher-listen` watch application root by default.
https://github.com/jonleighton/spring-watcher-listen/blob/c4bfe15805867e229588e4b776a7b87438137094/lib/spring/watcher/listen.rb#L58

This is necessary to watch the file (e.g. `.ruby-version`) in the
application root.

By this `node_modules` also be watched, and it is a possibility to be
shown a warning by `listen`.
Related to rails#32700, rails#34912, rails/webpacker#1990.

`listen` watches directory recursive by default, and it cannot avoid it.
guard/listen#111

So If this warning happens, the only workaround the user can do is remove
the gem.

The issue is likely to occur more frequently in Rails 6 because
`rails new` runs `webpacker:install` by default. Because of such a
state, I think that we should not recommend to use
`spring-watcher-listen`.

Spring has polling watcher, restart process works without this
`spring-watcher-listen`.
Because of polling base, CPU load may be higher than listen base. Still
I think that it is better than the warning comes out.
  • Loading branch information
y-yagi committed Jun 2, 2019
1 parent 22274d3 commit 1ff98ed
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
3 changes: 0 additions & 3 deletions railties/lib/rails/generators/rails/app/templates/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ group :development do
<% if spring_install? -%>
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
<% if depend_on_listen? -%>
gem 'spring-watcher-listen', '~> 2.0.0'
<% end -%>
<% end -%>
end

Expand Down
1 change: 0 additions & 1 deletion railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,6 @@ def assert_no_gem(gem)

def assert_listen_related_configuration
assert_gem "listen"
assert_gem "spring-watcher-listen"

assert_file "config/environments/development.rb" do |content|
assert_match(/^\s*config\.file_watcher = ActiveSupport::EventedFileUpdateChecker/, content)
Expand Down

0 comments on commit 1ff98ed

Please sign in to comment.