Class: Glossarist::SchemaMigration::CliPipeline
- Inherits:
-
Object
- Object
- Glossarist::SchemaMigration::CliPipeline
- Defined in:
- lib/glossarist/schema_migration/cli_pipeline.rb
Overview
Orchestrator for the glossarist upgrade CLI command.
Reads source concepts from a directory, dispatches each file to the
right migrator (V0ToV1 for IEV-legacy hashes, V2ToV3 for model-level
version bumps), reads register.yaml, and writes the output either as
a directory of YAML files or as a .gcr ZIP package.
This is the third concern that previously lived tangled in SchemaMigration itself (alongside V0ToV1 and V2ToV3). Splitting it out keeps each module at a single abstraction level:
- V0ToV1: hash → hash transform
- V2ToV3: model → model transform
- CliPipeline (this file): file I/O + dispatch + output writing
Instance Attribute Summary collapse
-
#cross_references ⇒ Object
readonly
Returns the value of attribute cross_references.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
-
#target_version ⇒ Object
readonly
Returns the value of attribute target_version.
Instance Method Summary collapse
-
#initialize(source_dir, output:, target_version:, cross_references: nil, dry_run: false) ⇒ CliPipeline
constructor
A new instance of CliPipeline.
- #run ⇒ Object
Constructor Details
#initialize(source_dir, output:, target_version:, cross_references: nil, dry_run: false) ⇒ CliPipeline
Returns a new instance of CliPipeline.
24 25 26 27 28 29 30 31 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 24 def initialize(source_dir, output:, target_version:, cross_references: nil, dry_run: false) @source_dir = File.(source_dir) @output = output @target_version = target_version @cross_references = cross_references @dry_run = dry_run end |
Instance Attribute Details
#cross_references ⇒ Object (readonly)
Returns the value of attribute cross_references.
21 22 23 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 21 def cross_references @cross_references end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
21 22 23 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 21 def dry_run @dry_run end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
21 22 23 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 21 def output @output end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
21 22 23 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 21 def source_dir @source_dir end |
#target_version ⇒ Object (readonly)
Returns the value of attribute target_version.
21 22 23 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 21 def target_version @target_version end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/glossarist/schema_migration/cli_pipeline.rb', line 33 def run validate_source! concepts = read_and_migrate_concepts register_data = read_register_yaml write_output(concepts, register_data) { concepts: concepts, register_data: register_data, source_version: source_version, target_version: target_version, output: File.(output), count: concepts.length, } end |