Module: Textus::Application::Tools::MigrateManifestToKinds
- Defined in:
- lib/textus/application/tools/migrate_manifest_to_kinds.rb
Class Method Summary collapse
Class Method Details
.infer_kind(row) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/textus/application/tools/migrate_manifest_to_kinds.rb', line 21 def infer_kind(row) return "intake" if row["intake"].is_a?(Hash) || row["intake_handler"] return "derived" if row["template"] || row["compute"] || row["generator"] || row["projection"] return "nested" if row["nested"] == true "leaf" end |
.upgrade_row(row) ⇒ Object
15 16 17 18 19 |
# File 'lib/textus/application/tools/migrate_manifest_to_kinds.rb', line 15 def upgrade_row(row) return row if row["kind"] row.merge("kind" => infer_kind(row)) end |
.upgrade_yaml(yaml_text) ⇒ Object
9 10 11 12 13 |
# File 'lib/textus/application/tools/migrate_manifest_to_kinds.rb', line 9 def upgrade_yaml(yaml_text) raw = YAML.safe_load(yaml_text, aliases: false) raw["entries"] = Array(raw["entries"]).map { |row| upgrade_row(row) } YAML.dump(raw) end |