fix source type typo
This commit is contained in:
parent
bfd4e5d7fa
commit
ff11be93a0
|
@ -9,13 +9,12 @@ module Middleman
|
|||
class Data < Extension
|
||||
attr_reader :data_store
|
||||
|
||||
# The regex which tells Middleman which files are for data
|
||||
DATA_FILE_MATCHER = /^(.*?)[\w-]+\.(yml|yaml|json)$/
|
||||
|
||||
def initialize(app, config={}, &block)
|
||||
super
|
||||
|
||||
# The regex which tells Middleman which files are for data
|
||||
data_file_matcher = /^(.*?)[\w-]+\.(yml|yaml|json)$/
|
||||
|
||||
@data_store = DataStore.new(app, data_file_matcher)
|
||||
@data_store = DataStore.new(app, DATA_FILE_MATCHER)
|
||||
app.config.define_setting :data_dir, 'data', 'The directory data files are stored in'
|
||||
|
||||
app.add_to_config_context(:data, &method(:data_store))
|
||||
|
@ -29,7 +28,7 @@ module Middleman
|
|||
# Tell the file watcher to observe the :data_dir
|
||||
@watcher = app.files.watch :data,
|
||||
path: File.join(app.root, dir),
|
||||
ignore: proc { |f| !data_file_matcher.match(f[:relative_path]) }
|
||||
ignore: proc { |f| !DATA_FILE_MATCHER.match(f[:relative_path]) }
|
||||
|
||||
# Setup data files before anything else so they are available when
|
||||
# parsing config.rb
|
||||
|
|
|
@ -293,7 +293,7 @@ module Middleman
|
|||
Contract ArrayOf[CallbackDescriptor], ArrayOf[SourceFile], ArrayOf[SourceFile] => Any
|
||||
def run_callbacks(callback_descriptors, updated_files, removed_files)
|
||||
callback_descriptors.each do |callback|
|
||||
if callback[:type] != :all
|
||||
if callback[:type] == :all
|
||||
callback[:proc].call(updated_files, removed_files)
|
||||
else
|
||||
valid_updated = updated_files.select { |f| callback[:type] == f[:type] }
|
||||
|
|
Loading…
Reference in a new issue