Class: Expressir::Commands::ChangesImportEengine
- Defined in:
- lib/expressir/commands/changes_import_eengine.rb
Overview
Command to import eengine comparison XML to EXPRESS Changes YAML
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.call(input_file, output_file, schema_name, version, **options) ⇒ Object
File-based workflow (backward compatible).
-
.from_xml(xml_content, schema_name, version, **options) ⇒ Expressir::Changes::SchemaChange
Parse XML string and convert to SchemaChange.
Methods inherited from Base
#exit_with_error, #initialize, #say
Constructor Details
This class inherits a constructor from Expressir::Commands::Base
Class Method Details
.call(input_file, output_file, schema_name, version, **options) ⇒ Object
File-based workflow (backward compatible)
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/expressir/commands/changes_import_eengine.rb', line 29 def self.call(input_file, output_file, schema_name, version, **) require "expressir/changes" xml_content = File.read(input_file) # Load existing schema if output file exists existing_schema = if output_file && File.exist?(output_file) && File.size(output_file).positive? Expressir::Changes::SchemaChange.from_file(output_file) end change_schema = from_xml(xml_content, schema_name, version, existing_schema: existing_schema, **) if output_file change_schema.to_file(output_file) puts "Change YAML file written to: #{output_file}" if [:verbose] else puts change_schema.to_yaml end change_schema end |
.from_xml(xml_content, schema_name, version, **options) ⇒ Expressir::Changes::SchemaChange
Parse XML string and convert to SchemaChange
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/expressir/commands/changes_import_eengine.rb', line 17 def self.from_xml(xml_content, schema_name, version, **) require "expressir/changes" # Parse into CompareReport using Lutaml::Model compare_report = Expressir::Eengine::CompareReport.from_xml(xml_content) # Convert to SchemaChange convert_to_schema_change(compare_report, schema_name, version, xml_content: xml_content, **) end |