Class: Suma::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/suma/processor.rb

Constant Summary collapse

COLLECTION_OUTPUT_PATH =

Emitted collection manifest that both the normal and staged builds render.

"collection-output.yaml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metanorma_yaml_path:, schemas_all_path:, compile: true, output_directory: "_site", staged: false) ⇒ Processor

Returns a new instance of Processor.



13
14
15
16
17
18
19
20
21
22
# File 'lib/suma/processor.rb', line 13

def initialize(metanorma_yaml_path:, schemas_all_path:, compile: true,
               output_directory: "_site", staged: false)
  @metanorma_yaml_path = metanorma_yaml_path
  @schemas_all_path = schemas_all_path
  @compile_flag = compile
  @output_directory = output_directory
  # Opt-in memory-bounded staged build (metanorma/suma#94); the default
  # single-process build below is unchanged when false.
  @staged = staged
end

Instance Attribute Details

#compile_flagObject (readonly)

Returns the value of attribute compile_flag.



10
11
12
# File 'lib/suma/processor.rb', line 10

def compile_flag
  @compile_flag
end

#metanorma_yaml_pathObject (readonly)

Returns the value of attribute metanorma_yaml_path.



10
11
12
# File 'lib/suma/processor.rb', line 10

def metanorma_yaml_path
  @metanorma_yaml_path
end

#output_directoryObject (readonly)

Returns the value of attribute output_directory.



10
11
12
# File 'lib/suma/processor.rb', line 10

def output_directory
  @output_directory
end

#schemas_all_pathObject (readonly)

Returns the value of attribute schemas_all_path.



10
11
12
# File 'lib/suma/processor.rb', line 10

def schemas_all_path
  @schemas_all_path
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/suma/processor.rb', line 24

def run
  Utils.log "Current directory: #{Dir.getwd}, writing #{schemas_all_path}..."

  collection_config = export_schema_config

  return nil unless @compile_flag

  Utils.log "Compiling schema collection..."
  compile_schema(schemas_all_path, collection_config)

  Utils.log "Compiling complete collection..."
  compile_collection(collection_config, output_directory)
end