Make the list of regexes ignored by FileWatcher configurable

This commit is contained in:
Ben Hollis 2013-05-02 22:09:54 -07:00
parent 5970333ca2
commit 1d88a52170
2 changed files with 4 additions and 1 deletions

View file

@ -3,6 +3,7 @@ master
* DataStore may now be accessed like a hash with #[] and #has_key?. #880 * DataStore may now be accessed like a hash with #[] and #has_key?. #880
* The i18n extension now supports providing localized templates as separate files, like index.es.html.haml. #816, #823 * The i18n extension now supports providing localized templates as separate files, like index.es.html.haml. #816, #823
* The list of regular expressions for which files are ignored by the file watcher are now configurable.
3.1.0.beta.2 3.1.0.beta.2
=== ===

View file

@ -27,6 +27,8 @@ module Middleman
def registered(app) def registered(app)
app.send :include, InstanceMethods app.send :include, InstanceMethods
app.config.define_setting :file_watcher_ignore, IGNORE_LIST, 'Regexes for paths that should be ignored when they change.'
# Before parsing config, load the data/ directory # Before parsing config, load the data/ directory
app.before_configuration do app.before_configuration do
files.reload_path(config[:data_dir]) files.reload_path(config[:data_dir])
@ -146,7 +148,7 @@ module Middleman
# @return [Boolean] # @return [Boolean]
def ignored?(path) def ignored?(path)
path = path.to_s path = path.to_s
IGNORE_LIST.any? { |r| path =~ r } config[:file_watcher_ignore].any? { |r| path =~ r }
end end
# Notify callbacks for a file given an array of callbacks # Notify callbacks for a file given an array of callbacks