Class: Textus::Manifest::Entry::Produced

Inherits:
Base show all
Defined in:
lib/textus/manifest/entry/produced.rb

Overview

A produced entry (ADR 0095) — anything with a ‘source:`. The produce method (intake/derived/external) is read from source.from; there is no separate kind for it. Merges the former Derived + Intake classes.

Constant Summary collapse

KIND =
:produced

Constants inherited from Textus::Manifest::Entry

REGISTRY

Instance Attribute Summary collapse

Attributes inherited from Base

#format, #key, #owner, #path, #publish_targets, #raw, #schema, #zone

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#ignore, #ignored?, #in_proposal_zone?, #leaf?, #publish_mode, #publish_to, #publish_tree, #tracked?, #zone_writers

Constructor Details

#initialize(source:, events: {}, **rest) ⇒ Produced

Returns a new instance of Produced.



10
11
12
13
14
# File 'lib/textus/manifest/entry/produced.rb', line 10

def initialize(source:, events: {}, **rest)
  super(**rest)
  @source = source
  @events = events || {}
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



8
9
10
# File 'lib/textus/manifest/entry/produced.rb', line 8

def events
  @events
end

#sourceObject (readonly)

Returns the value of attribute source.



8
9
10
# File 'lib/textus/manifest/entry/produced.rb', line 8

def source
  @source
end

Class Method Details

.from_raw(common, raw) ⇒ Object



48
49
50
# File 'lib/textus/manifest/entry/produced.rb', line 48

def self.from_raw(common, raw)
  new(source: Parser.parse_source(raw, common[:key]), events: raw["events"] || {}, **common)
end

Instance Method Details

#configObject



22
# File 'lib/textus/manifest/entry/produced.rb', line 22

def config      = @source.config

#derived?Boolean

Returns:

  • (Boolean)


17
# File 'lib/textus/manifest/entry/produced.rb', line 17

def derived?    = @source.kind == :derived

#external?Boolean

Returns:

  • (Boolean)


18
# File 'lib/textus/manifest/entry/produced.rb', line 18

def external?   = @source.external?

#handlerObject



21
# File 'lib/textus/manifest/entry/produced.rb', line 21

def handler     = @source.handler

#intake?Boolean

Returns:

  • (Boolean)


16
# File 'lib/textus/manifest/entry/produced.rb', line 16

def intake?     = @source.kind == :intake

#nested?Boolean

Returns:

  • (Boolean)


20
# File 'lib/textus/manifest/entry/produced.rb', line 20

def nested?     = !!@raw["nested"]

#projection?Boolean

Returns:

  • (Boolean)


19
# File 'lib/textus/manifest/entry/produced.rb', line 19

def projection? = @source.projection?

#publish_via(pctx, prefix: nil) ⇒ Object

ADR 0094/0095: projection (from: project) sources build their DATA artifact here, then publish via the ONE shared mode (Publish::ToPaths). Intake bytes come from Produce::Acquire::Intake and command (external) bytes from the out-of-band runner — neither builds, but both still publish their existing store bytes through the same mode. A projection entry with no targets is a terminal data node: it produced data, so report :built even though nothing was emitted.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/textus/manifest/entry/produced.rb', line 33

def publish_via(pctx, prefix: nil)
  built = false
  if projection?
    Textus::Produce::Acquire::Projection.new(container: pctx.container, call: pctx.call).run(self)
    built = true
    pctx.emit(:entry_produced, key: @key, envelope: pctx.reader.call(@key), sources: Array(@source.select).compact)
  end

  emitted = publish_mode.publish(pctx, prefix: prefix)
  return emitted if emitted
  return nil unless built

  { kind: :built, value: { "key" => @key, "path" => Key::Path.resolve(pctx.manifest.data, self), "published_to" => [] } }
end