Class: Suma::SchemaExporter

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

Overview

SchemaExporter exports EXPRESS schemas from a manifest with configurable options for annotations and ZIP packaging

Constant Summary collapse

CATEGORY_MAP =
{
  ExpressSchema::Type::RESOURCE => "resources",
  ExpressSchema::Type::MODULE_ARM => "modules",
  ExpressSchema::Type::MODULE_MIM => "modules",
  ExpressSchema::Type::BUSINESS_OBJECT_MODEL => "business_object_models",
  ExpressSchema::Type::CORE_MODEL => "core_model",
  ExpressSchema::Type::STANDALONE => ".",
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schemas:, output_path:, options: {}) ⇒ SchemaExporter

Returns a new instance of SchemaExporter.



22
23
24
25
26
# File 'lib/suma/schema_exporter.rb', line 22

def initialize(schemas:, output_path:, options: {})
  @schemas = schemas
  @output_path = Pathname.new(output_path).expand_path
  @options = default_options.merge(options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



20
21
22
# File 'lib/suma/schema_exporter.rb', line 20

def options
  @options
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



20
21
22
# File 'lib/suma/schema_exporter.rb', line 20

def output_path
  @output_path
end

#schemasObject (readonly)

Returns the value of attribute schemas.



20
21
22
# File 'lib/suma/schema_exporter.rb', line 20

def schemas
  @schemas
end

Instance Method Details

#exportObject



28
29
30
31
32
33
34
35
# File 'lib/suma/schema_exporter.rb', line 28

def export
  Utils.log "Exporting schemas to: #{output_path}"

  export_to_directory(schemas)
  create_zip_archive if options[:create_zip]

  Utils.log "Export complete!"
end