Class: Textus::Application::Writes::Materializer

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

Overview

Materializes a single Derived manifest entry onto disk by running the builder pipeline (template + projection + external runner). Extracted from Application::Writes::Build so that Publish can reuse it without creating a Build dependency.

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, manifest:, file_store:, bus:, root:, store:) ⇒ Materializer

Returns a new instance of Materializer.



11
12
13
14
15
16
17
18
# File 'lib/textus/application/writes/materializer.rb', line 11

def initialize(ctx:, manifest:, file_store:, bus:, root:, store:)
  @ctx        = ctx
  @manifest   = manifest
  @file_store = file_store
  @bus        = bus
  @root       = root
  @store      = store
end

Instance Method Details

#run(mentry) ⇒ Object

Runs the builder pipeline for ‘mentry` and returns the on-disk target_path string.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/textus/application/writes/materializer.rb', line 22

def run(mentry)
  reader = Textus::Application::Reads::Get.new(
    ctx: @ctx, manifest: @manifest, file_store: @file_store,
  )
  lister = Textus::Application::Reads::List.new(manifest: @manifest)
  Builder::Pipeline.run(
    mentry: mentry,
    manifest: @manifest,
    reader: reader.method(:call),
    lister: lister.method(:call),
    transform_resolver: ->(name) { @bus.rpc_callable(:transform_rows, name) },
    template_loader: ->(name) { read_template(name) },
    transform_context: @store,
    inject_intro: -> { Textus::Intro.run(@store) },
  )
end