Class: Textus::Manifest::Entry::Publish::SubtreeMirror
- Inherits:
-
Object
- Object
- Textus::Manifest::Entry::Publish::SubtreeMirror
- Defined in:
- lib/textus/manifest/entry/publish/subtree_mirror.rb
Overview
ADR 0049: the one walk->publish->prune pipeline behind Tree (whole-entry mirror, ADR 0047). It was once shared with the per-leaf publish_each mode too; ADR 0051 removed publish_each, leaving Tree the only caller. The ‘walk_root`/`prune_honors_ignore:` parameters survive from that shared shape — Tree always walks at `base` and honors `ignore` in the prune (ADR 0047 D4, so a derived index in the mirrored dir survives).
Instance Method Summary collapse
-
#initialize(entry, pctx) ⇒ SubtreeMirror
constructor
A new instance of SubtreeMirror.
-
#mirror(base:, walk_root:, target_dir:, key:, envelope:, prune_honors_ignore:) ⇒ Object
base: store dir the entry owns — the root ‘ignored?` globs are relative to (ADR 0042).
Constructor Details
#initialize(entry, pctx) ⇒ SubtreeMirror
Returns a new instance of SubtreeMirror.
12 13 14 15 |
# File 'lib/textus/manifest/entry/publish/subtree_mirror.rb', line 12 def initialize(entry, pctx) @entry = entry @pctx = pctx end |
Instance Method Details
#mirror(base:, walk_root:, target_dir:, key:, envelope:, prune_honors_ignore:) ⇒ Object
base: store dir the entry owns — the root ‘ignored?` globs are
relative to (ADR 0042).
walk_root: dir the glob is rooted at (== base for Tree). dst paths
mirror rel-to-walk_root.
target_dir: repo-side destination root. key/envelope: emitted per file; envelope is nil for the keyless Tree. prune_honors_ignore: when true a managed file the entry ‘ignore`s
survives the prune (ADR 0047 D4 — lets a derived index live in the
mirrored dir); when false every unwritten managed file is pruned.
26 27 28 29 30 31 |
# File 'lib/textus/manifest/entry/publish/subtree_mirror.rb', line 26 def mirror(base:, walk_root:, target_dir:, key:, envelope:, prune_honors_ignore:) return { written: [], pruned: [] } unless File.directory?(walk_root) written = publish_files(base: base, walk_root: walk_root, target_dir: target_dir, key: key, envelope: envelope) { written: written, pruned: prune(target_dir, written, prune_honors_ignore) } end |