Class: Textus::Doctor::Check::Hooks

Inherits:
Textus::Doctor::Check show all
Defined in:
lib/textus/doctor/check/hooks.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
# File 'lib/textus/doctor/check/hooks.rb', line 5

def call
  out = []
  dir = File.join(root, "steps")
  return out unless File.directory?(dir)

  Textus::Step::Loader.new(registry: Textus::Step::RegistryStore.new).load_dir(dir)
  out
rescue Textus::UsageError => e
  out << {
    "code" => "step.load_failed",
    "level" => "error",
    "subject" => "steps",
    "message" => e.message,
    "fix" => "open the named step file under .textus/steps/ and fix the error",
  }
  out
end