App-Actions

 view release on metacpan or  search on metacpan

lib/App/Actions/Runner/Support.pm  view on Meta::CPAN

C<runner.env_cycle>, not a partly filled-in value.  To add to a variable
from an outer layer, give the new value another name.

=item * B<L</default_logger> does not filter by level.>  It prints every
message it is given.  To keep only some levels, or to write them to a file,
give the run a L<Log::Abstraction> logger of your own (see
L<App::Actions/new>).

=back

=head1 ENCODING

Environment names and values, step text and secrets are Perl character
strings and may contain any Unicode text, including non-ASCII characters
and emoji.  L</write_container_file> writes the bytes it is given: encode
text (for example as UTF-8) before you pass it.  Paths are used as bytes.
Action paths (C<./...>) should be ASCII, as on GitHub.

=head1 AUTHOR

Nigel Horne, C<njh@nigelhorne.com>

=head1 FORMAL SPECIFICATION

This section describes each routine in the Z notation, a precise
mathematical language for describing programs.  You do not need to read it
to use the module: everything here is also said in plain words in the
sections above.  It is for readers who want to check exactly what a routine
promises.

How to read it: a box names a routine.  The lines above the middle rule
declare the values it works with.  A name ending in C<?> is an input, and a
name ending in C<!> is an output.  C<ΞState> means the routine changes
nothing, and C<ΔState> means it can change the state.  The lines below the
rule are the conditions that are always true when the routine returns.

=head2 status_flags

	┌─ StatusFlags ─────────────────────────────────────
	│ failed? : 𝔹
	│ s!      : {success, failure, cancelled} → 𝔹
	├───────────────────────────────────────────────────
	│ s!(success) = ¬ failed? ∧ s!(failure) = failed? ∧ s!(cancelled) = false
	└───────────────────────────────────────────────────

=head2 chomp_error

	┌─ ChompError ──────────────────────────────────────
	│ error? : VALUE
	│ s!     : seq CHAR
	├───────────────────────────────────────────────────
	│ s! = rtrim(string(error?))
	└───────────────────────────────────────────────────

=head2 default_logger

	┌─ DefaultLogger ───────────────────────────────────
	│ logger! : LogAbstraction
	├───────────────────────────────────────────────────
	│ ∀ level : LEVEL; m : seq CHAR •
	│     logger!.log(level, m) ⇒ stderr' = stderr ⁀ m ⁀ ⟨NEWLINE⟩
	│ logger!.history = ⟨⟩
	└───────────────────────────────────────────────────

=head2 null_logger

	┌─ NullLogger ──────────────────────────────────────
	│ logger! : LogAbstraction
	├───────────────────────────────────────────────────
	│ ∀ level : LEVEL; m : seq CHAR • logger!.log(level, m) ⇒ stderr' = stderr
	└───────────────────────────────────────────────────

=head2 trim_error

	┌─ TrimError ───────────────────────────────────────
	│ error? : VALUE
	│ s!     : optional seq CHAR
	├───────────────────────────────────────────────────
	│ error? = ⊥ ∨ string(error?) = ⟨⟩ ⇒ s! = ⊥
	│ otherwise s! = Describe(error?)
	└───────────────────────────────────────────────────

=head2 resolve_env

	┌─ ResolveEnv ──────────────────────────────────────
	│ layers?  : seq (NAME ⇸ VALUE)
	│ context? : CONTEXT
	│ env!     : NAME ⇸ seq CHAR
	├───────────────────────────────────────────────────
	│ let merged == ⊕/ layers?
	│ let refs == {a, b : dom merged | interpolating merged(a) reads env.b}
	│ (∃ n : dom merged • (n, n) ∈ refs⁺) ⇒ raise runner.env_cycle
	│ otherwise env! = μ e • {n : dom merged •
	│     n ↦ interpolate(merged(n), context? ⊕ {env ↦ e})}
	│ (each merged(n) is interpolated once; a result is never re-read)
	└───────────────────────────────────────────────────

=head2 boolean_value

	┌─ BooleanValue ────────────────────────────────────
	│ value? : VALUE
	│ b!     : 𝔹
	├───────────────────────────────────────────────────
	│ value? ∈ REF ⇒ b! = truthy(value?)
	│ value? = ⊥ ∨ trim(value?) = ⟨⟩ ⇒ b! = false
	│ trim(value?) ∈ TRUE_WORD ⇒ b! = true
	│ trim(value?) ∈ FALSE_WORD ⇒ b! = false
	│ otherwise b! = condition(trim(value?))
	└───────────────────────────────────────────────────

=head2 has_status_function

	┌─ HasStatusFunction ───────────────────────────────
	│ condition? : optional seq CHAR
	│ b!         : 𝔹
	├───────────────────────────────────────────────────
	│ b! ⇔ condition? ≠ ⊥ ∧ condition? contains f( for some f ∈ STATUS
	└───────────────────────────────────────────────────

=head2 write_container_file

	┌─ WriteContainerFile ──────────────────────────────
	│ ΔFileSystem
	│ path?, contents? : seq CHAR
	├───────────────────────────────────────────────────
	│ files' = files ⊕ {path? ↦ contents?}
	└───────────────────────────────────────────────────

=head2 local_action_path



( run in 1.241 second using v1.01-cache-2.11-cpan-60884a8df76 )