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

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

Direct Known Subclasses

Derived, Intake, Leaf, Nested

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:, zone:, schema:, owner:, format:, publish_to: []) ⇒ 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:, zone:, schema:, owner:, format:, publish_to: [])
  @raw = raw
  @key = key
  @path = path
  @zone = zone
  @schema = schema
  @owner = owner
  @format = format
  @publish_to = Array(publish_to)
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

#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_toObject (readonly)

Returns the value of attribute publish_to.



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

def publish_to
  @publish_to
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

#zoneObject (readonly)

Returns the value of attribute zone.



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

def zone
  @zone
end

Instance Method Details

#derived?Boolean

Returns:

  • (Boolean)


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

def derived? = false

#eventsObject



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

def events         = {}

#ignoreObject



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

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)


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

def ignored?(_rel_path) = false

#in_generator_zone?(policy) ⇒ Boolean

Returns:

  • (Boolean)


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

def in_generator_zone?(policy) = policy.derived_zone?(@zone)

#in_proposal_zone?(policy) ⇒ Boolean

Returns:

  • (Boolean)


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

def in_proposal_zone?(policy)  = policy.queue_zone?(@zone)

#inject_bootObject

rubocop:disable Naming/PredicateMethod



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

def inject_boot    = false # rubocop:disable Naming/PredicateMethod

#intake?Boolean

Returns:

  • (Boolean)


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

def intake?  = false

#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

#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.



84
85
86
# File 'lib/textus/manifest/entry/base.rb', line 84

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

#publish_treeObject



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

def publish_tree   = nil

#publish_via(pctx, prefix: nil) ⇒ Object

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



90
91
92
# File 'lib/textus/manifest/entry/base.rb', line 90

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

#templateObject

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



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

def template       = nil

#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)


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

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

#zone_writers(policy) ⇒ Object

rubocop:enable Metrics/ParameterLists, Lint/MissingSuper



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

def zone_writers(policy)
  policy.zone_writers(@zone)
rescue UsageError => e
  raise UsageError.new("entry '#{@key}': #{e.message}")
end