Class: Textus::Ports::Publisher
- Inherits:
-
Object
- Object
- Textus::Ports::Publisher
- Defined in:
- lib/textus/ports/publisher.rb
Overview
Publishes built artifacts from the store to repo-relative consumer paths. Publish = copy + sentinel. The in-store file is already the consumer-shaped artifact; no parsing or stripping.
Sentinel I/O is delegated to Textus::Ports::SentinelStore. Sentinels live under ‘<store_root>/.run/sentinels/` (runtime, git-ignored — ADR 0070) and mirror the target’s repo-relative layout so consumer directories aren’t polluted with ‘.textus-managed.json` siblings.
An instantiable class (ADR 0109).
Instance Method Summary collapse
- #publish(source:, target:, store_root:, provenance_source: source) ⇒ Object
-
#unpublish(target:, store_root:) ⇒ Object
Removes a previously-published file and its sentinel.
Instance Method Details
#publish(source:, target:, store_root:, provenance_source: source) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/textus/ports/publisher.rb', line 16 def publish(source:, target:, store_root:, provenance_source: source) FileUtils.mkdir_p(File.dirname(target)) guard_clobber(source, target, store_root) File.delete(target) if File.symlink?(target) FileUtils.cp(source, target) Textus::Ports::SentinelStore.new.write!(target: target, source: provenance_source, store_root: store_root) end |
#unpublish(target:, store_root:) ⇒ Object
Removes a previously-published file and its sentinel. No-op unless the target is textus-managed — never deletes an unmanaged file.
26 27 28 29 30 31 32 |
# File 'lib/textus/ports/publisher.rb', line 26 def unpublish(target:, store_root:) return unless managed?(target, store_root) FileUtils.rm_f(target) sentinel = Textus::Ports::SentinelStore.new.sentinel_path(target, store_root) FileUtils.rm_f(sentinel) end |