Merge pull request #882 from bhollis/filewatch

Make the list of regexes ignored by FileWatcher configurable
This commit is contained in:
Thomas Reynolds 2013-05-02 22:50:22 -07:00
commit a0363210d6
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