class

Fluxion::Config::Context

Inherits Reference < Object

Shared state and field helpers for one parse.

Parsing collects diagnostics instead of raising, so a profile with five mistakes takes one run to fix rather than five. Helpers therefore return a usable placeholder on failure and record the problem; the caller checks the collector once at the end.

Constants

ISO_DURATION = /\AP(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?\z/i
OCTAL_MODE = /\A[0-7]{3,4}\z/

Constructors

new(base_dir : String, host : HostFacts = HostFacts.new, diagnostics : DiagnosticCollector = DiagnosticCollector.new)
Source

Instance methods

absolute_path(node : Node, required : Bool = true) : String | Nil

An absolute, normalized filesystem path, after ~ expansion.

Source
archive_path(node : Node) : String | Nil

A normalized relative POSIX path, used for archive member selection.

Source
base_dir

Directory containing the profile. Relative script, working-directory, and creates paths resolve against this so a profile stays portable regardless of where it is run from.

Source
bool(node : Node, default : Bool) : Bool

Note the explicit nil check: node.bool? || default would quietly turn an explicit false into the default, which is exactly backwards for fields like gpgCheck where false is the dangerous value.

Source
bool?(node : Node) : Bool | Nil

Tri-state: nil when the key is absent, so "not stated" stays distinct from "explicitly false".

Source
checksum(node : Node) : Checksum | Nil

A {algorithm, value} checksum block.

Source
diagnostics
Source
duration(node : Node, default : Time::Span) : Time::Span

Durations accept both the ISO-8601 form the stable schema documents and the compact forms manifests use (30m, 90s, 500ms, 120).

Source
enum_value(node : Node, subject : String, accepted : Array(String), & : String -> T | Nil) : T | Nil forall T

Parses an enum-style field, reporting the accepted spellings when it does not match. Returns nil after recording the error.

Source
error(path : String, message : String, hint : String | Nil = nil) : Nil
Source
expand_home(raw : String) : String

Expands a leading ~ only. A ~ in the middle of a path is a literal character, and replacing every occurrence would corrupt real filenames.

Source
file_mode(node : Node) : String | Nil
Source
fingerprint(node : Node) : Fingerprint | Nil
Source
host
Source
https_url(node : Node, required : Bool = true) : String | Nil

Requires an absolute HTTPS URL with a host and no embedded credentials.

All three are checked and reported together rather than one per run, because a URL that is wrong in two ways should not take two attempts to fix. Credentials in a URL are rejected outright: they end up in process listings, and Fluxion would have to redact them everywhere afterwards.

Source
int(node : Node, default : Int32) : Int32
Source
local_path(node : Node, required : Bool = true) : String | Nil

A path that may be relative, resolved against the profile directory.

Source
optional_string(node : Node) : String | Nil
Source
parse_duration(value : String) : Time::Span | Nil
Source
require_string(node : Node, subject : String | Nil = nil) : String

A required string field. Records a diagnostic and returns "" when absent, so the surrounding parse can keep going and report everything else too.

Source
resolve_local(raw : String) : String
Source
sha256(node : Node) : Checksum | Nil

A bare sha256: <hex> field.

Source
warning(path : String, message : String, hint : String | Nil = nil) : Nil
Source