Class: Equilibrium::Commands::CatalogCommand
- Inherits:
-
Object
- Object
- Equilibrium::Commands::CatalogCommand
- Includes:
- Mixins::ErrorHandling, Mixins::InputOutput
- Defined in:
- lib/equilibrium/commands/catalog_command.rb
Overview
Command for converting expected tags JSON to catalog format
Instance Method Summary collapse
-
#execute(file_path = nil) ⇒ Object
Execute the catalog command.
Methods included from Mixins::InputOutput
#format_output, #read_input_data
Methods included from Mixins::ErrorHandling
Instance Method Details
#execute(file_path = nil) ⇒ Object
Execute the catalog command
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/equilibrium/commands/catalog_command.rb', line 20 def execute(file_path = nil) with_error_handling do # Read input from file or stdin input = read_input_data(file_path, "No input provided. Use: equilibrium expected registry | equilibrium catalog") # Parse and validate JSON data = JSON.parse(input) SchemaValidator.validate!(data, Equilibrium::Schemas::EXPECTED_ACTUAL, error_prefix: "Schema validation failed") # Convert to catalog format catalog = CatalogBuilder.build_catalog(data) # Output as JSON puts JSON.pretty_generate(catalog) end end |