6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/textus/manifest/entry/validators/format_matrix.rb', line 6
def self.call(entry)
begin
Textus::Entry.for_format(entry.format).validate_path_extension(entry.path, entry.nested?)
rescue UsageError => e
raise UsageError.new("entry '#{entry.key}': #{e.message}")
end
if entry.format == "text" && !entry.schema.nil?
raise UsageError.new("entry '#{entry.key}': text format must not declare a schema")
end
has_template = entry.respond_to?(:template) && !entry.template.nil?
is_external = entry.derived? && entry.external?
return unless entry.in_generator_zone? && !has_template && !is_external &&
%w[markdown text].include?(entry.format) && !entry.nested?
raise UsageError.new("entry '#{entry.key}': derived #{entry.format} entries require a template")
end
|