fix source type typo
This commit is contained in:
parent
bfd4e5d7fa
commit
ff11be93a0
3 changed files with 7 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -243,7 +243,7 @@ module Middleman
|
|||
@options.all_settings.each do |o|
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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