realbook v0.1.0 Realbook.Commands View Source

Command macros that are helper functions for common tasks.

imported into your Realbook scripts by default.

Link to this section Summary

Functions

appends binary content to the target file.

raises Realbook.ExecutionError automatically with the issued comment.

gets a value from the Realbook key/value store. Registers the key as required prior to running the script.

gets a value from the Realbook key/value store, providing a default value if the key has not been set yet.

sends a log message with canonical realbook metadata and desired message.

runs a command on the remote host.

runs a command on the remote host.

sends binary content to the target.

sets key/value pairs into the Realbook key/value store. Registers the keys as provided by the script.

pauses for time milliseconds

like append!/3 but useful for files which are owned by superuser.

like run/2, except with the command run as superuser

like run!/2, except with the command run as superuser

like send/3 but changes posession of the file to superuser after transmission.

Link to this section Functions

Link to this macro

append!(content, path, opts \\ [])

View Source (macro)

appends binary content to the target file.

returns ok if successful and raises on either a connection error or a sending error.

raises Realbook.ExecutionError automatically with the issued comment.

gets a value from the Realbook key/value store. Registers the key as required prior to running the script.

Link to this macro

get(key, default)

View Source (macro)

gets a value from the Realbook key/value store, providing a default value if the key has not been set yet.

Important

This will not set the value if it has not been set yet.

sends a log message with canonical realbook metadata and desired message.

Link to this macro

run(cmd, opts \\ [])

View Source (macro)

runs a command on the remote host.

For options, consult your adapter module.

raises Realbook.ExecutionError if there is a connection error.

if the command is executed, returns:

  • {:ok, stdout} if the command has zero return code.
  • {:error, error, retcode} if the command has nonzero return code.
Link to this macro

run!(cmd, opts \\ [])

View Source (macro)

runs a command on the remote host.

For options, consult your adapter module.

raises Realbook.ExecutionError if there is a connection error OR if the executed command returns a nonzero return code.

if the command returns a zero return code, this macro returns the standard output of the command.

Link to this macro

send!(content, path, opts \\ [])

View Source (macro)

sends binary content to the target.

returns ok if successful and raises on either a connection error or a sending error.

sets key/value pairs into the Realbook key/value store. Registers the keys as provided by the script.

pauses for time milliseconds

Link to this macro

sudo_append!(content, path, opts \\ [])

View Source (macro)

like append!/3 but useful for files which are owned by superuser.

Link to this macro

sudo_run(cmd, opts \\ [])

View Source (macro)

like run/2, except with the command run as superuser

Link to this macro

sudo_run!(cmd, opts \\ [])

View Source (macro)

like run!/2, except with the command run as superuser

Link to this macro

sudo_send!(content, path, opts \\ [])

View Source (macro)

like send/3 but changes posession of the file to superuser after transmission.