Refactor FileWatcher

This commit is contained in:
Thomas Reynolds 2014-03-25 16:54:16 -07:00
parent 6ccab8e071
commit 9ae8a3128b
12 changed files with 98 additions and 48 deletions

View file

@ -223,14 +223,16 @@ module Middleman
def self.all_files_under(path, &ignore)
path = Pathname(path)
return [] if ignore && ignore.call(path)
if path.directory?
path.children.flat_map do |child|
all_files_under(child, &ignore)
end.compact
elsif path.file?
[path]
if block_given? && ignore.call(path)
[]
else
[path]
end
else
[]
end