realbook v0.2.0 Realbook.Macros View Source

Top-level macros that you will use to build out Realbook scripts.

These are imported into your Realbook scripts by default.

Link to this section Summary

Functions

defines actions that perform the operations of a realbook script

defines a list of realbook files which should be run prior to running this realbook file.

defines actions that assess the completion of a realbook script.

Link to this section Functions

Link to this function

load_module_by_file(file)

View Source

defines actions that perform the operations of a realbook script

this action is triggered if verify/1 fails. If any event in the play/1 raises, then the system will halt and throw Realbook.ExecutionError.

defines a list of realbook files which should be run prior to running this realbook file.

Usage

This directive should be at the head of the realbook script.

requires "foo.exs"

or you may also submit a list of files

requires ~w(foo.exs bar.exs baz.exs)

warning:

this doesn't currently perform cyclical dependency checks.

defines actions that assess the completion of a realbook script.

These actions are performed twice. Once prior to execution, and once after execution. If the first verification stage fails, the play/1 stage is activated. If it succeeds, the play/1 stage is not activated.

The verification is repeated after play/1. If it fails at this stage, the system will halt and throw Realbook.ExecutionError.

Typically, the contents of the verification stage should not alter the remote target, but only perform analysis of the system.

To cause the play/1 block to always execute, you may declare:

verify false

Guidelines

Verification fails when one of two things happens:

  • any internal directive raises
  • the block returns false

Generally speaking the verify/2 block should contain a sequence of validating run! directives which, if any fails causes a failure. If you are retrieving value(s) that need to be compared (for example shasums), drop those comparisons as the last test to trigger the final boolean value check.

If you want to quit early on a boolean comparison value and avoid long-running or computationally expensive checks, you can use the following type of statement:

unless <comparison>, do: fail! "failure message"