Module: Textus::Manifest::Entry::Publish

Defined in:
lib/textus/manifest/entry/publish.rb,
lib/textus/manifest/entry/publish/mode.rb,
lib/textus/manifest/entry/publish/none.rb,
lib/textus/manifest/entry/publish/tree.rb,
lib/textus/manifest/entry/publish/template.rb,
lib/textus/manifest/entry/publish/to_paths.rb,
lib/textus/manifest/entry/publish/subtree_mirror.rb

Overview

ADR 0049: the publish design is a key-split concept (ADR 0047 table) realized as one resolved sum type. Each directory entry resolves, once, to one Publish::* mode that owns its publish algorithm — no nil-cascade, no pairwise exclusivity guards, one shared subtree mirror. ADR 0051 removed ‘publish_each` (both leaf modes); ADR 0052 folded the two surviving keys into one `publish:` block (`to:` xor `tree:`). The surface is two modes:

None      — nothing to publish (no publish: block)
ToPaths   — publish: { to: [...] }  — 1 stored file -> N fixed repo paths
Tree      — publish: { tree: "dir" } — whole entry subtree -> 1 dir, no keys

Defined Under Namespace

Modules: Template Classes: Mode, None, SubtreeMirror, ToPaths, Tree

Class Method Summary collapse

Class Method Details

.resolve(entry) ⇒ Object

Resolve an entry to its single publish mode. The publish config is the ADR 0052 ‘publish:` block, sourced into entry.publish_to/publish_tree. Raises one UsageError if both `publish.to` and `publish.tree` are set —the block groups the two but does not make exclusivity structural, so this stays the one enforcement point (ADR 0052 D2).



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/textus/manifest/entry/publish.rb', line 20

def self.resolve(entry)
  reject_removed_publish_each(entry)

  set = []
  set << "publish.to"   unless Array(entry.publish_to).empty?
  set << "publish.tree" unless entry.publish_tree.nil?

  if set.length > 1
    raise Textus::UsageError.new(
      "entry '#{entry.key}': #{set.join(" and ")} are mutually exclusive — an entry publishes exactly one way",
    )
  end

  mode_for(entry, set.first)
end