Fix source watcher configuration

This commit is contained in:
Rene Klacan 2016-10-27 15:10:28 +02:00
parent 7c968b9572
commit 8b4e2d043c
4 changed files with 44 additions and 21 deletions

View file

@ -53,18 +53,15 @@ module Middleman
# Create a new collection of sources.
#
# @param [Middleman::Application] app The parent app.
# @param [Hash] options Global options.
# @param [Array] watchers Default watchers.
Contract IsA['Middleman::Application'], Maybe[Hash], Maybe[Array] => Any
def initialize(app, options={}, watchers=[])
Contract IsA['Middleman::Application'], Maybe[Array] => Any
def initialize(app, watchers=[])
@app = app
@watchers = watchers
@sorted_watchers = @watchers.dup.freeze
::Middleman::Sources.file_cache = {}
@options = options
# Set of procs wanting to be notified of changes
@on_change_callbacks = ::Hamster::Vector.empty
@ -172,7 +169,7 @@ module Middleman
# @return [Middleman::Sources]
Contract Symbol => ::Middleman::Sources
def by_type(type)
self.class.new @app, @options, watchers.select { |d| d.type == type }
self.class.new @app, watchers.select { |d| d.type == type }
end
# Get all files for this collection of watchers.