listen gem started using full paths instead of relative. Fixes #1374

This commit is contained in:
Thomas Reynolds 2014-09-15 15:36:41 -07:00
parent 2ff64fe3a3
commit e326e10e98

View file

@ -208,8 +208,12 @@ module Middleman
# @param [Array<String>] paths Array of paths to check # @param [Array<String>] paths Array of paths to check
# @return [Boolean] Whether the server needs to reload # @return [Boolean] Whether the server needs to reload
def needs_to_reload?(paths) def needs_to_reload?(paths)
relative_paths = paths.map do |p|
Pathname(p).relative_path_from(Pathname(app.root)).to_s
end
match_against = [ match_against = [
%r{^config\.rb}, %r{^config\.rb$},
%r{^lib/[^\.](.*)\.rb$}, %r{^lib/[^\.](.*)\.rb$},
%r{^helpers/[^\.](.*)\.rb$} %r{^helpers/[^\.](.*)\.rb$}
] ]
@ -220,7 +224,7 @@ module Middleman
end end
end end
paths.any? do |path| relative_paths.any? do |path|
match_against.any? do |matcher| match_against.any? do |matcher|
path =~ matcher path =~ matcher
end end