lib/nanoc/data_sources/filesystem.rb in nanoc-4.11.14 vs lib/nanoc/data_sources/filesystem.rb in nanoc-4.11.15
- old
+ new
@@ -46,10 +46,16 @@
# understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
# one will be inferred from the environment.
#
# @api private
class Filesystem < Nanoc::DataSource
+ class AmbiguousMetadataAssociationError < ::Nanoc::Core::Error
+ def initialize(content_filenames, meta_filename)
+ super("There are multiple content files (#{content_filenames.sort.join(', ')}) that could match the file containing metadata (#{meta_filename}).")
+ end
+ end
+
identifiers :filesystem, :filesystem_unified
# See {Nanoc::DataSource#up}.
def up; end
@@ -83,13 +89,13 @@
end
def changes_for_dir(dir)
require 'listen'
- Nanoc::ChangesStream.new do |cl|
+ Nanoc::Core::ChangesStream.new do |cl|
listener =
- Listen.to(dir, latency: 0.0, wait_for_delay: 0.0) do |_modifieds, _addeds, _deleteds|
+ Listen.to(dir, latency: 0.1, wait_for_delay: 0.0) do |_modifieds, _addeds, _deleteds|
cl.unknown
end
listener.start
@@ -201,10 +207,10 @@
meta_filename = filename_for(base_filename, meta_ext)
content_filenames = content_exts.map { |e| filename_for(base_filename, e) }
have_possible_ambiguity = meta_filename && content_filenames.size > 1
if have_possible_ambiguity && content_filenames.count { |fn| !parser.frontmatter?(fn) } != 1
- raise Nanoc::Int::Errors::AmbiguousMetadataAssociation.new(content_filenames, meta_filename)
+ raise Nanoc::DataSources::Filesystem::AmbiguousMetadataAssociationError.new(content_filenames, meta_filename)
end
content_filenames.each do |content_filename|
real_meta_filename =
if have_possible_ambiguity && parser.frontmatter?(content_filename)