From 5cadcc7479394b6b48ad2b5362104511ece52ad6 Mon Sep 17 00:00:00 2001 From: eno Date: Sun, 6 Nov 2016 18:23:55 +0100 Subject: No longer listens to dirs inside of installed gems rails5 uses the listen gem to watch for changes from autoload directories and from i18n directories. Changes there would be reflected by the running app, in development mode usually. However, files outside of the application directory or locally installed gems should not change during development, and rails does not need to reflect changes there if they do. This change makes sure only those paths that do not originate from the app itself are watched. This can help especially with the situation on OSX, where rb-fsevent - which implements file watching - is quite a resource hog. --- activesupport/lib/active_support/evented_file_update_checker.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb index f54f88eb0a..e5fbc133b0 100644 --- a/activesupport/lib/active_support/evented_file_update_checker.rb +++ b/activesupport/lib/active_support/evented_file_update_checker.rb @@ -121,6 +121,11 @@ module ActiveSupport dtw.compact! dtw.uniq! + normalized_gem_paths = Gem.path.map { |path| File.join path, "" } + dtw = dtw.reject do |path| + normalized_gem_paths.any? { |gem_path| path.to_s.starts_with?(gem_path) } + end + @ph.filter_out_descendants(dtw) end -- cgit v1.2.3