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
# File 'lib/textus/doctor/check/templates.rb', line 5

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

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

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