Module: Textus::Manifest::Entry::Validators::Publish

Defined in:
lib/textus/manifest/entry/validators/publish.rb

Overview

ADR 0049: one publish validator. Exclusivity among the publish keys is enforced structurally by Publish.resolve (reached via #publish_mode), and each mode’s shape rules run *because that mode resolved* — replacing the four scattered pairwise “not-both” guards of the old PublishEach + PublishTree validators. Misuse on a non-nested entry is still caught here from raw, since the typed attrs stub nil on Base.

Class Method Summary collapse

Class Method Details

.call(entry, policy: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



12
13
14
15
16
17
18
19
20
21
# File 'lib/textus/manifest/entry/validators/publish.rb', line 12

def self.call(entry, policy: nil) # rubocop:disable Lint/UnusedMethodArgument
  unless entry.nested?
    %w[publish_each publish_tree].each do |key|
      raise UsageError.new("entry '#{entry.key}': #{key} requires nested: true") if entry.raw[key]
    end
    return
  end

  entry.publish_mode.validate!
end