Refactor FileWatcher
This commit is contained in:
parent
6ccab8e071
commit
9ae8a3128b
12 changed files with 98 additions and 48 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue