Module: Textus::Manifest::Schema::Semantics::Migration
- Included in:
- Textus::Manifest::Schema::Semantics
- Defined in:
- lib/textus/manifest/schema/semantics/migration.rb
Instance Method Summary collapse
- #check_migration!(raw) ⇒ Object
- #check_retired_publish_keys!(entry, path) ⇒ Object
- #check_retired_render_keys!(entry, path) ⇒ Object
- #check_rules_retired_keys!(rules) ⇒ Object
Instance Method Details
#check_migration!(raw) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/textus/manifest/schema/semantics/migration.rb', line 6 def check_migration!(raw) Array(raw["entries"]).each_with_index do |e, i| path = "$.entries[#{i}]" check_retired_publish_keys!(e, path) check_retired_render_keys!(e, path) end check_rules_retired_keys!(raw["rules"]) end |
#check_retired_publish_keys!(entry, path) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/textus/manifest/schema/semantics/migration.rb', line 15 def check_retired_publish_keys!(entry, path) return unless entry.is_a?(Hash) if entry.key?("publish_each") raise BadManifest.new( "publish_each was removed in 0.42.0 (ADR 0051) at '#{path}' — " \ "mirror the subtree with `publish: { tree: \"...\" }`.", ) end if entry.key?("publish_to") raise BadManifest.new( "publish_to was replaced by the publish: block in 0.43.0 (ADR 0052) at '#{path}' — " \ "use `publish: { to: [...] }`.", ) end if entry.key?("publish_tree") raise BadManifest.new( "publish_tree was replaced by the publish: block in 0.43.0 (ADR 0052) at '#{path}' — " \ "use `publish: { tree: \"...\" }`.", ) end return unless entry.key?("index_filename") raise BadManifest.new( "index_filename was removed in 0.43.0 (ADR 0053) at '#{path}'.", ) end |
#check_retired_render_keys!(entry, path) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/textus/manifest/schema/semantics/migration.rb', line 43 def check_retired_render_keys!(entry, path) return unless entry.is_a?(Hash) if entry.key?("template") raise BadManifest.new( "entry-level `template:` was removed at '#{path}' (ADR 0094): rendering is a " \ "publish concern — `publish: [{ to:, template: }]`.", ) end if entry.key?("inject_boot") raise BadManifest.new( "entry-level `inject_boot:` was removed at '#{path}' (ADR 0094).", ) end return unless entry.key?("provenance") raise BadManifest.new("entry-level `provenance:` was removed at '#{path}' (ADR 0094).") end |
#check_rules_retired_keys!(rules) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/textus/manifest/schema/semantics/migration.rb', line 62 def check_rules_retired_keys!(rules) Array(rules).each_with_index do |r, i| path = "$.rules[#{i}]" { "lifecycle" => "age GC moved to `retention:` rule", "materialize" => "removed (ADR 0093)" } .each do |old, hint| next unless r.is_a?(Hash) && r.key?(old) raise BadManifest.new("`#{old}:` was removed at '#{path}' (ADR 0093) — #{hint}.") end next unless r.is_a?(Hash) && r.key?("upkeep") raise BadManifest.new( "rule key `upkeep:` was removed (ADR 0093): move age-GC to `retention:` " \ "and production to the entry's `source:`", ) end end |