Class: Textus::Application::Writes::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/writes/build.rb

Overview

Materializes generator-zone entries (template + projection) onto disk and copies the result to any configured ‘publish_to` / `publish_each` targets. Fires `:built` and `:published` events on the bus, tagged with the request’s correlation_id for traceability.

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, bus:) ⇒ Build

Returns a new instance of Build.



11
12
13
14
# File 'lib/textus/application/writes/build.rb', line 11

def initialize(ctx:, bus:)
  @ctx = ctx
  @bus = bus
end

Instance Method Details

#call(prefix: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/textus/application/writes/build.rb', line 16

def call(prefix: nil)
  built = []
  manifest.entries.each do |mentry|
    next unless mentry.in_generator_zone?
    next unless mentry.projection || mentry.template
    next if prefix && !mentry.key.start_with?(prefix)

    built << materialize(mentry)
  end
  published_leaves = publish_leaves(prefix: prefix)
  { "protocol" => Textus::PROTOCOL, "built" => built, "published_leaves" => published_leaves }
end