Class: Textus::Manifest::Entry::Base

Inherits:
Textus::Manifest::Entry show all
Defined in:
lib/textus/manifest/entry/base.rb

Direct Known Subclasses

Leaf, Nested, Produced

Defined Under Namespace

Classes: PublishContext

Constant Summary

Constants inherited from Textus::Manifest::Entry

REGISTRY

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:, key:, path:, lane:, schema:, owner:, format:, publish_targets: []) ⇒ Base

rubocop:disable Metrics/ParameterLists, Lint/MissingSuper



8
9
10
11
12
13
14
15
16
17
# File 'lib/textus/manifest/entry/base.rb', line 8

def initialize(raw:, key:, path:, lane:, schema:, owner:, format:, publish_targets: [])
  @raw = raw
  @key = key
  @path = path
  @lane = lane
  @schema = schema
  @owner = owner
  @format = format
  @publish_targets = Array(publish_targets)
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def format
  @format
end

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def key
  @key
end

#laneObject (readonly) Also known as: zone

Returns the value of attribute lane.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def lane
  @lane
end

#ownerObject (readonly)

Returns the value of attribute owner.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def owner
  @owner
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def path
  @path
end

#publish_targetsObject (readonly)

Returns the value of attribute publish_targets.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def publish_targets
  @publish_targets
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def raw
  @raw
end

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/textus/manifest/entry/base.rb', line 5

def schema
  @schema
end

Instance Method Details

#derived?Boolean

Returns:

  • (Boolean)


30
# File 'lib/textus/manifest/entry/base.rb', line 30

def derived? = false

#eventsObject

Nil stubs for cross-cutting optional attrs. Subclasses override the ones they own. Validators and serializers can call these directly without ‘respond_to?` guards.



57
# File 'lib/textus/manifest/entry/base.rb', line 57

def events         = {}

#external?Boolean

Production traits. Default false on Base (a leaf/intake entry is neither an out-of-band command nor a projection); Produced overrides both from its source. Lets publish modes call these without a ‘respond_to?` guard.

Returns:

  • (Boolean)


37
# File 'lib/textus/manifest/entry/base.rb', line 37

def external?   = false

#ignoreObject



58
# File 'lib/textus/manifest/entry/base.rb', line 58

def ignore         = []

#ignored?(_rel_path) ⇒ Boolean

Per-entry ignore (ADR 0042). Base entries enumerate no tree, so nothing is ever ignored; Nested overrides with real patterns.

Returns:

  • (Boolean)


62
# File 'lib/textus/manifest/entry/base.rb', line 62

def ignored?(_rel_path) = false

#in_proposal_lane?(policy) ⇒ Boolean Also known as: in_proposal_zone?

Returns:

  • (Boolean)


27
# File 'lib/textus/manifest/entry/base.rb', line 27

def in_proposal_lane?(policy) = policy.queue_lane?(@lane)

#intake?Boolean

Returns:

  • (Boolean)


31
# File 'lib/textus/manifest/entry/base.rb', line 31

def intake?  = false

#lane_writers(policy) ⇒ Object

rubocop:enable Metrics/ParameterLists, Lint/MissingSuper



20
21
22
23
24
25
# File 'lib/textus/manifest/entry/base.rb', line 20

def lane_writers(policy)
  verb = policy.verb_for_lane(@lane)
  policy.roles_with_capability(verb)
rescue UsageError => e
  raise UsageError.new("entry '#{@key}': #{e.message}")
end

#leaf?Boolean

Returns:

  • (Boolean)


32
# File 'lib/textus/manifest/entry/base.rb', line 32

def leaf?    = false

#nested?Boolean

Returns:

  • (Boolean)


29
# File 'lib/textus/manifest/entry/base.rb', line 29

def nested?  = false

#projection?Boolean

Returns:

  • (Boolean)


38
# File 'lib/textus/manifest/entry/base.rb', line 38

def projection? = false

#publish_modeObject

ADR 0049: an entry resolves, once, to one Publish::* mode that owns its publish algorithm. A plain entry publishes via ToPaths (publish_to) or None; Nested resolves among the key/path-driven modes. Derived overrides publish_via to materialize first.



108
109
110
# File 'lib/textus/manifest/entry/base.rb', line 108

def publish_mode
  @publish_mode ||= Publish.resolve(self)
end

#publish_toObject

Single source of truth is @publish_targets (ADR 0094). These derive the ADR-0049/0052 views the publish modes consume.



51
# File 'lib/textus/manifest/entry/base.rb', line 51

def publish_to   = @publish_targets.select(&:to_target?).map(&:to)

#publish_treeObject



52
# File 'lib/textus/manifest/entry/base.rb', line 52

def publish_tree = @publish_targets.find(&:tree_target?)&.tree

#publish_via(pctx, prefix: nil) ⇒ Object

Returns: { kind: :built|:leaves, value: … } to be accumulated by Write::Build, or nil to skip.



114
115
116
# File 'lib/textus/manifest/entry/base.rb', line 114

def publish_via(pctx, prefix: nil)
  publish_mode.publish(pctx, prefix: prefix)
end

#tracked?Boolean

Whether git should track this entry’s file. Default true; an entry marked ‘tracked: false` in the manifest stays protocol-readable but is listed in the generated `.gitignore` (ADR 0043). Cross-cutting, so it reads from raw here rather than threading through every constructor.

Returns:

  • (Boolean)


47
# File 'lib/textus/manifest/entry/base.rb', line 47

def tracked? = @raw["tracked"] != false