aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/evented_file_update_checker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/evented_file_update_checker.rb')
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb
index 3893b0de0e..6075e0a3d3 100644
--- a/activesupport/lib/active_support/evented_file_update_checker.rb
+++ b/activesupport/lib/active_support/evented_file_update_checker.rb
@@ -107,13 +107,23 @@ module ActiveSupport
private
def boot!
- Listen.to(*@dtw, &method(:changed)).start
+ normalize_dirs!
+
+ unless @dtw.empty?
+ Listen.to(*@dtw, &method(:changed)).start
+ end
end
def shutdown!
Listen.stop
end
+ def normalize_dirs!
+ @dirs.transform_keys! do |dir|
+ dir.exist? ? dir.realpath : dir
+ end
+ end
+
def changed(modified, added, removed)
unless updated?
@updated.make_true if (modified + added + removed).any? { |f| watching?(f) }
@@ -187,13 +197,6 @@ module ActiveSupport
lcsp
end
- # Returns the deepest existing ascendant, which could be the argument itself.
- def existing_parent(dir)
- dir.ascend do |ascendant|
- break ascendant if ascendant.directory?
- end
- end
-
# Filters out directories which are descendants of others in the collection (stable).
def filter_out_descendants(dirs)
return dirs if dirs.length < 2
@@ -214,7 +217,6 @@ module ActiveSupport
end
private
-
def ascendant_of?(base, other)
base != other && other.ascend do |ascendant|
break true if base == ascendant