Class: Suma::Cli

Inherits:
Thor
  • Object
show all
Extended by:
ThorExt::Start
Defined in:
lib/suma/cli.rb

Instance Method Summary collapse

Methods included from ThorExt::Start

extended, start

Instance Method Details

#build(metanorma_site_manifest) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/suma/cli.rb', line 19

def build(metanorma_site_manifest)
  unless File.exist?(metanorma_site_manifest)
    raise Errno::ENOENT, "Specified Metanorma site manifest file " \
      "`#{metanorma_site_manifest}` not found."
  end

  # Set schemas_all_path to match metanorma_yaml_path
  schemas_all_path = options[:schemas_all_path] ||
    metanorma_site_manifest.gsub("metanorma", "schemas")

  begin
    Processor.run(
      metanorma_yaml_path: metanorma_site_manifest,
      schemas_all_path: schemas_all_path,
      compile: options[:compile],
      output_directory: "_site",
    )
  rescue StandardError => e
    Utils.log "[ERROR] Error occurred during processing. See details below."
    Utils.log e
    Utils.log e.inspect
    Utils.log e.backtrace.join("\n")
  end
end