Class: Textus::Doctor::Check::Templates

Inherits:
Textus::Doctor::Check show all
Defined in:
lib/textus/doctor/check/templates.rb

Instance Method Summary collapse

Methods inherited from Textus::Doctor::Check

#initialize, name_key

Constructor Details

This class inherits a constructor from Textus::Doctor::Check

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/textus/doctor/check/templates.rb', line 5

def call
  out = []
  manifest.data.entries.each do |entry|
    entry.publish_targets.each do |target|
      template = target.template
      next if template.nil?

      tp = File.join(root, "templates", template)
      next if File.exist?(tp)

      out << {
        "code" => "template.missing",
        "level" => "error",
        "subject" => entry.key,
        "message" => "template '#{template}' not found at #{tp}",
        "fix" => "create the file at #{tp} or update the publish target's template: field",
      }
    end
  end
  out
end