Class: Textus::Write::Materializer

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(container:, call:) ⇒ Materializer

Returns a new instance of Materializer.



10
11
12
13
14
15
16
17
# File 'lib/textus/write/materializer.rb', line 10

def initialize(container:, call:)
  @container  = container
  @call       = call
  @manifest   = container.manifest
  @file_store = container.file_store
  @rpc        = container.rpc
  @root       = container.root
end

Instance Method Details

#run(mentry) ⇒ Object

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



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

def run(mentry)
  reader = Textus::Read::Get.new(container: @container, call: @call)
  lister = Textus::Read::List.new(container: @container)
  Builder::Pipeline.run(
    mentry: mentry,
    deps: Builder::Pipeline::Deps.new(
      manifest: @manifest,
      reader: reader.method(:call),
      lister: lister.method(:call),
      rpc: @rpc,
      template_loader: ->(name) { read_template(name) },
      transform_context: @container,
      inject_boot: -> { Textus::Boot.build(container: @container) },
    ),
  )
end