Class: Textus::Application::Writes::Publish
- Inherits:
-
Object
- Object
- Textus::Application::Writes::Publish
- Defined in:
- lib/textus/application/writes/publish.rb
Overview
Single-pass publish use case: materializes Derived entries (template + projection + external runner) AND copies Leaf/Nested entries to their publish targets. Replaces the former two-step Build + Publish split.
Return shape: { “protocol”, “built”, “published_leaves” } — wire-compatible with what the ‘textus build` CLI verb previously
assembled by merging Build + old Publish results.
Instance Method Summary collapse
- #call(prefix: nil) ⇒ Object
-
#initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) ⇒ Publish
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) ⇒ Publish
rubocop:disable Metrics/ParameterLists
12 13 14 15 16 17 18 19 20 |
# File 'lib/textus/application/writes/publish.rb', line 12 def initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) # rubocop:disable Metrics/ParameterLists @ctx = ctx @manifest = manifest @file_store = file_store @bus = bus @root = root @store = store @hook_context = hook_context end |
Instance Method Details
#call(prefix: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/textus/application/writes/publish.rb', line 22 def call(prefix: nil) built = [] leaves = [] repo_root = File.dirname(@root) @manifest.entries.each do |mentry| next if prefix && !entry_matches_prefix?(mentry, prefix) case mentry when Textus::Manifest::Entry::Derived next unless mentry.in_generator_zone? result = materialize_derived(mentry, repo_root) built << result if result when Textus::Manifest::Entry::Nested next unless mentry.publish_each publish_nested(mentry, repo_root, prefix, leaves) when Textus::Manifest::Entry::Leaf next if Array(mentry.publish_to).empty? result = publish_leaf_entry(mentry, repo_root) built << result if result end end { "protocol" => Textus::PROTOCOL, "built" => built, "published_leaves" => leaves } end |