Class: Suma::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Processor.



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

def initialize(metanorma_yaml_path:, schemas_all_path:, compile: true,
               output_directory: "_site")
  @metanorma_yaml_path = metanorma_yaml_path
  @schemas_all_path = schemas_all_path
  @compile_flag = compile
  @output_directory = output_directory
end

Instance Attribute Details

#compile_flagObject (readonly)

Returns the value of attribute compile_flag.



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

def compile_flag
  @compile_flag
end

#metanorma_yaml_pathObject (readonly)

Returns the value of attribute metanorma_yaml_path.



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

def metanorma_yaml_path
  @metanorma_yaml_path
end

#output_directoryObject (readonly)

Returns the value of attribute output_directory.



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

def output_directory
  @output_directory
end

#schemas_all_pathObject (readonly)

Returns the value of attribute schemas_all_path.



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

def schemas_all_path
  @schemas_all_path
end

Instance Method Details

#runObject



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

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