aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authoreno <eno@open-lab.org>2016-11-06 18:23:55 +0100
committereno <eno@open-lab.org>2016-11-08 08:45:35 +0100
commit5cadcc7479394b6b48ad2b5362104511ece52ad6 (patch)
tree5d3861e6bc2b3cfece9068016f7a94d5c0ed4e48 /activesupport
parent3359093ff622438141add95edf350c0b288176a0 (diff)
downloadrails-5cadcc7479394b6b48ad2b5362104511ece52ad6.tar.gz
rails-5cadcc7479394b6b48ad2b5362104511ece52ad6.tar.bz2
rails-5cadcc7479394b6b48ad2b5362104511ece52ad6.zip
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.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb5
1 files changed, 5 insertions, 0 deletions
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