Class: Textus::Manifest::Entry
- Inherits:
-
Object
- Object
- Textus::Manifest::Entry
- Defined in:
- lib/textus/manifest/entry.rb,
lib/textus/manifest/entry/parser.rb,
lib/textus/manifest/entry/validators.rb,
lib/textus/manifest/entry/validators/events.rb,
lib/textus/manifest/entry/validators/inject_intro.rb,
lib/textus/manifest/entry/validators/publish_each.rb,
lib/textus/manifest/entry/validators/format_matrix.rb,
lib/textus/manifest/entry/validators/index_filename.rb
Defined Under Namespace
Modules: Parser, Validators
Constant Summary collapse
- PUBLISH_EACH_VARS =
Re-exported for backward compatibility with callers that referenced these constants on Entry. Canonical source is the PublishEach validator.
Validators::PublishEach::KNOWN_VARS
- PUBLISH_EACH_VAR_RE =
Validators::PublishEach::VAR_RE
Instance Attribute Summary collapse
-
#compute ⇒ Object
readonly
Returns the value of attribute compute.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#generator ⇒ Object
readonly
Returns the value of attribute generator.
-
#index_filename ⇒ Object
readonly
Returns the value of attribute index_filename.
-
#inject_intro ⇒ Object
readonly
Returns the value of attribute inject_intro.
-
#intake_config ⇒ Object
readonly
Returns the value of attribute intake_config.
-
#intake_handler ⇒ Object
readonly
Returns the value of attribute intake_handler.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#nested ⇒ Object
readonly
Returns the value of attribute nested.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#projection ⇒ Object
readonly
Returns the value of attribute projection.
-
#publish_each ⇒ Object
readonly
Returns the value of attribute publish_each.
-
#publish_to ⇒ Object
readonly
Returns the value of attribute publish_to.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#zone ⇒ Object
readonly
Returns the value of attribute zone.
Instance Method Summary collapse
-
#in_generator_zone? ⇒ Boolean
Signal-based zone-kind predicates: derive the “kind” of a zone from its write_policy signals rather than its literal name, so detection keeps working when users rename the default zones.
- #in_proposal_zone? ⇒ Boolean
-
#initialize(manifest:, raw:, key:, path:, zone:, schema:, owner:, nested:, template:, publish_to:, publish_each:, events:, inject_intro:, index_filename:, format:, compute:, projection:, generator:, intake_handler:, intake_config:) ⇒ Entry
constructor
rubocop:disable Metrics/ParameterLists.
-
#publish_target_for(full_key) ⇒ Object
Resolves the per-leaf target path (relative to repo root) for a full dotted key under this entry’s prefix.
Constructor Details
#initialize(manifest:, raw:, key:, path:, zone:, schema:, owner:, nested:, template:, publish_to:, publish_each:, events:, inject_intro:, index_filename:, format:, compute:, projection:, generator:, intake_handler:, intake_config:) ⇒ Entry
rubocop:disable Metrics/ParameterLists
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/textus/manifest/entry.rb', line 16 def initialize(manifest:, raw:, key:, path:, zone:, schema:, owner:, nested:, template:, publish_to:, publish_each:, events:, inject_intro:, index_filename:, format:, compute:, projection:, generator:, intake_handler:, intake_config:) @manifest = manifest @raw = raw @key = key @path = path @zone = zone @schema = schema @owner = owner @nested = nested @template = template @publish_to = publish_to @publish_each = publish_each @events = events @inject_intro = inject_intro @index_filename = index_filename @format = format @compute = compute @projection = projection @generator = generator @intake_handler = intake_handler @intake_config = intake_config end |
Instance Attribute Details
#compute ⇒ Object (readonly)
Returns the value of attribute compute.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def compute @compute end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def events @events end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def format @format end |
#generator ⇒ Object (readonly)
Returns the value of attribute generator.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def generator @generator end |
#index_filename ⇒ Object (readonly)
Returns the value of attribute index_filename.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def index_filename @index_filename end |
#inject_intro ⇒ Object (readonly)
Returns the value of attribute inject_intro.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def inject_intro @inject_intro end |
#intake_config ⇒ Object (readonly)
Returns the value of attribute intake_config.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def intake_config @intake_config end |
#intake_handler ⇒ Object (readonly)
Returns the value of attribute intake_handler.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def intake_handler @intake_handler end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def key @key end |
#nested ⇒ Object (readonly)
Returns the value of attribute nested.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def nested @nested end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def owner @owner end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def path @path end |
#projection ⇒ Object (readonly)
Returns the value of attribute projection.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def projection @projection end |
#publish_each ⇒ Object (readonly)
Returns the value of attribute publish_each.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def publish_each @publish_each end |
#publish_to ⇒ Object (readonly)
Returns the value of attribute publish_to.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def publish_to @publish_to end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def raw @raw end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def schema @schema end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def template @template end |
#zone ⇒ Object (readonly)
Returns the value of attribute zone.
9 10 11 |
# File 'lib/textus/manifest/entry.rb', line 9 def zone @zone end |
Instance Method Details
#in_generator_zone? ⇒ Boolean
Signal-based zone-kind predicates: derive the “kind” of a zone from its write_policy signals rather than its literal name, so detection keeps working when users rename the default zones.
65 66 67 |
# File 'lib/textus/manifest/entry.rb', line 65 def in_generator_zone? zone_writers.include?("builder") end |
#in_proposal_zone? ⇒ Boolean
69 70 71 |
# File 'lib/textus/manifest/entry.rb', line 69 def in_proposal_zone? zone_writers.include?("agent") end |
#publish_target_for(full_key) ⇒ Object
Resolves the per-leaf target path (relative to repo root) for a full dotted key under this entry’s prefix. Returns nil if this entry has no publish_each template.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/textus/manifest/entry.rb', line 46 def publish_target_for(full_key) return nil if @publish_each.nil? entry_segs = @key.split(".") key_segs = full_key.split(".") raise UsageError.new("key '#{full_key}' is not under entry '#{@key}'") unless key_segs[0, entry_segs.length] == entry_segs remaining = key_segs[entry_segs.length..] || [] leaf = remaining.join("/") basename = remaining.last || "" ext = Textus::Entry.for_format(@format).extensions.first.to_s.sub(/^\./, "") vars = { "leaf" => leaf, "basename" => basename, "key" => full_key, "ext" => ext } @publish_each.gsub(PUBLISH_EACH_VAR_RE) { vars.fetch(::Regexp.last_match(1)) } end |