CommandFormula class abstract

A reusable base for formulas whose actions are platform-specific shell commands (the common case for installing/managing software).

Subclasses provide a verify probe and per-action command templates keyed by OS family. Install is made idempotent: if validate already passes, it reports changed: false without running the install command.

Inheritance
Implementers

Constructors

CommandFormula({CommandExecutor executor = const ProcessCommandExecutor()})
Creates a command formula with executor.

Properties

executor → CommandExecutor
Runs the underlying commands.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spec → FormulaSpec
The static metadata describing this formula.
no setterinherited
verifyStep → CommandStep
The verify probe (e.g. docker --version).
no setter
versionPattern → RegExp
A regex capturing the version from the verify output.
no setter

Methods

install(FormulaContext context) → Future<FormulaResult>
Installs the managed software.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restart(FormulaContext context) → Future<FormulaResult>
Restarts the managed service.
override
run(FormulaAction action, FormulaContext context) → Future<FormulaResult>
Dispatches the given action to the matching method.
inherited
start(FormulaContext context) → Future<FormulaResult>
Starts the managed service.
override
status(FormulaContext context) → Future<FormulaStatusReport>
Present first, running second.
override
statusFrom(ExecResult result) → FormulaStatus
Maps a statusStepFor probe's outcome to a status.
statusStepFor(String osName) → CommandStep?
The probe that says whether what this formula manages is running, or null when it manages nothing that runs.
stepFor(FormulaAction action, String osName) → CommandStep?
Returns the command template for action on osName, or null if the action is unsupported on that platform.
stop(FormulaContext context) → Future<FormulaResult>
Stops the managed service.
override
toString() → String
A string representation of this object.
inherited
uninstall(FormulaContext context) → Future<FormulaResult>
Uninstalls the managed software.
override
update(FormulaContext context) → Future<FormulaResult>
Updates the managed software toward the target version.
override
validate(FormulaContext context) → Future<ValidationResult>
Validates that the managed software is present and healthy.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited