class

Fluxion::Condition

Inherits Reference < Object

A when guard on a plan entry or on an item inside commands, shell-scripts, or file-writes.

Every declared field must match — fields are ANDed — while the values inside one field are ORed. oneOf nests whole conditions and is ORed against its siblings' AND.

Constructors

new(os_family : Matcher | Nil = nil, distribution : Matcher | Nil = nil, version : Matcher | Nil = nil, codename : Matcher | Nil = nil, architecture : Matcher | Nil = nil, required_commands : Array(String) = [] of String, any_commands : Array(String) = [] of String, branches : Array(Condition) = [] of Condition)
Source

Instance methods

any_commands

commandExists: at least one of these must be on PATH.

Source
architecture
Source
branches

oneOf: at least one nested condition must match.

Source
codename
Source
distribution
Source
empty?

A condition that declares nothing always selects its entry.

Source
matches?(facts : HostFacts, &command_exists : String -> Bool) : Bool

Evaluates against detected host facts. The PATH lookup is injected so plan can evaluate conditions without an executor and so specs can drive it deterministically.

Source
matches?(facts : HostFacts, command_exists : Proc(String, Bool)) : Bool
Source
os_family
Source
required_commands

commands: every one of these must be on PATH.

Source
unmet_reason(facts : HostFacts, &command_exists : String -> Bool) : String | Nil

Explains the first unmet requirement, for the skip reason printed in plan, dry-run, and the TUI. Nil when the condition matches.

Evaluation and explanation share one implementation so a condition can never report "matched" while also producing a reason, or vice versa.

Source
unmet_reason(facts : HostFacts, command_exists : Proc(String, Bool)) : String | Nil

Takes a Proc rather than a block because oneOf recurses, and Crystal always inlines yielding calls.

Source
version
Source