Class: Textus::Protocol::Manifest::Entry::Base
- Inherits:
-
Entry
- Object
- Entry
- Textus::Protocol::Manifest::Entry::Base
- Defined in:
- lib/textus/protocol/manifest/entry/base.rb
Defined Under Namespace
Classes: PublishContext
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#lane ⇒ Object
readonly
Returns the value of attribute lane.
-
#naming ⇒ Object
readonly
Returns the value of attribute naming.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#publish_targets ⇒ Object
readonly
Returns the value of attribute publish_targets.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #derived? ⇒ Boolean
- #events ⇒ Object
-
#external? ⇒ Boolean
Production traits.
- #in_proposal_lane?(policy) ⇒ Boolean
-
#initialize(raw:, key:, path:, lane:, format:, schema: nil, naming: nil, publish_targets: []) ⇒ Base
constructor
rubocop:disable Lint/MissingSuper.
-
#lane_writers(policy) ⇒ Object
rubocop:enable Lint/MissingSuper.
- #leaf? ⇒ Boolean
- #nested? ⇒ Boolean
-
#publish_mode ⇒ Object
ADR 0049: an entry resolves, once, to one Publish::* mode that owns its publish algorithm.
-
#publish_to ⇒ Object
Single source of truth is @publish_targets (ADR 0094).
- #publish_tree ⇒ Object
- #publish_via(pctx, prefix: nil) ⇒ Object
-
#tracked? ⇒ Boolean
Whether git should track this entry's file.
- #with_publish_targets(pts) ⇒ Object
Constructor Details
#initialize(raw:, key:, path:, lane:, format:, schema: nil, naming: nil, publish_targets: []) ⇒ Base
rubocop:disable Lint/MissingSuper
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 9 def initialize(raw:, key:, path:, lane:, format:, schema: nil, naming: nil, publish_targets: []) @raw = raw @key = key @path = path @lane = lane @schema = schema @naming = naming @format = format @publish_targets = Array(publish_targets) end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def format @format end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def key @key end |
#lane ⇒ Object (readonly)
Returns the value of attribute lane.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def lane @lane end |
#naming ⇒ Object (readonly)
Returns the value of attribute naming.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def naming @naming end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def path @path end |
#publish_targets ⇒ Object (readonly)
Returns the value of attribute publish_targets.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def publish_targets @publish_targets end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def raw @raw end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
6 7 8 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 6 def schema @schema end |
Instance Method Details
#derived? ⇒ Boolean
29 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 29 def derived? = false |
#events ⇒ Object
48 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 48 def events = {} |
#external? ⇒ Boolean
Production traits. Default false on all non-produced entries.
Lets publish modes call these without a respond_to? guard.
35 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 35 def external? = false |
#in_proposal_lane?(policy) ⇒ Boolean
27 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 27 def in_proposal_lane?(policy) = policy.queue_lane?(@lane) |
#lane_writers(policy) ⇒ Object
rubocop:enable Lint/MissingSuper
21 22 23 24 25 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 21 def lane_writers(policy) policy.writers_for(@lane) rescue UsageError => e raise UsageError.new("entry '#{@key}': #{e.}") end |
#leaf? ⇒ Boolean
31 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 31 def leaf? = false |
#nested? ⇒ Boolean
30 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 30 def nested? = false |
#publish_mode ⇒ Object
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.
80 81 82 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 80 def publish_mode @publish_mode ||= Publish.resolve(self) end |
#publish_to ⇒ Object
Single source of truth is @publish_targets (ADR 0094). These derive the ADR-0049/0052 views the publish modes consume.
45 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 45 def publish_to = @publish_targets.select(&:to_target?).map(&:to) |
#publish_tree ⇒ Object
46 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 46 def publish_tree = @publish_targets.find(&:tree_target?)&.tree |
#publish_via(pctx, prefix: nil) ⇒ Object
84 85 86 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 84 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.
41 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 41 def tracked? = @raw["tracked"] != false |
#with_publish_targets(pts) ⇒ Object
88 89 90 |
# File 'lib/textus/protocol/manifest/entry/base.rb', line 88 def with_publish_targets(pts) dup.tap { |e| e.instance_variable_set(:@publish_targets, pts) } end |