fix source type typo
This commit is contained in:
parent
bfd4e5d7fa
commit
ff11be93a0
|
@ -9,13 +9,12 @@ module Middleman
|
||||||
class Data < Extension
|
class Data < Extension
|
||||||
attr_reader :data_store
|
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)
|
def initialize(app, config={}, &block)
|
||||||
super
|
super
|
||||||
|
@data_store = DataStore.new(app, DATA_FILE_MATCHER)
|
||||||
# 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)
|
|
||||||
app.config.define_setting :data_dir, 'data', 'The directory data files are stored in'
|
app.config.define_setting :data_dir, 'data', 'The directory data files are stored in'
|
||||||
|
|
||||||
app.add_to_config_context(:data, &method(:data_store))
|
app.add_to_config_context(:data, &method(:data_store))
|
||||||
|
@ -29,7 +28,7 @@ module Middleman
|
||||||
# Tell the file watcher to observe the :data_dir
|
# Tell the file watcher to observe the :data_dir
|
||||||
@watcher = app.files.watch :data,
|
@watcher = app.files.watch :data,
|
||||||
path: File.join(app.root, dir),
|
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
|
# Setup data files before anything else so they are available when
|
||||||
# parsing config.rb
|
# parsing config.rb
|
||||||
|
|
|
@ -243,7 +243,7 @@ module Middleman
|
||||||
@options.all_settings.each do |o|
|
@options.all_settings.each do |o|
|
||||||
next unless o.options[:required] && !o.value_set?
|
next unless o.options[:required] && !o.value_set?
|
||||||
|
|
||||||
logger.error "The `:#{o.key}` option of the `#{self.class.ext_name}` extension is required."
|
logger.error "The `:#{o.key}` option of the `#{self.class.ext_name}` extension is required."
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -293,7 +293,7 @@ module Middleman
|
||||||
Contract ArrayOf[CallbackDescriptor], ArrayOf[SourceFile], ArrayOf[SourceFile] => Any
|
Contract ArrayOf[CallbackDescriptor], ArrayOf[SourceFile], ArrayOf[SourceFile] => Any
|
||||||
def run_callbacks(callback_descriptors, updated_files, removed_files)
|
def run_callbacks(callback_descriptors, updated_files, removed_files)
|
||||||
callback_descriptors.each do |callback|
|
callback_descriptors.each do |callback|
|
||||||
if callback[:type] != :all
|
if callback[:type] == :all
|
||||||
callback[:proc].call(updated_files, removed_files)
|
callback[:proc].call(updated_files, removed_files)
|
||||||
else
|
else
|
||||||
valid_updated = updated_files.select { |f| callback[:type] == f[:type] }
|
valid_updated = updated_files.select { |f| callback[:type] == f[:type] }
|
||||||
|
|
Loading…
Reference in a new issue