Commit c58af148 authored by Léonard Messier's avatar Léonard Messier

feat(require, install): #114 implement a queue system for recipe steps

 What ?
-----------------

This paves the way for scenarios where we would like to
- rollback a recipe installation
- rollback all recipe installations
- reexecute a failed step
- reexecute a recipe

🐼 How ?
------------------

The awk script now transforms recipe blocks into lines that add lines
into a queue with a `[ ]` at the beginning.
We used heredocs to preserve double quotes.
Those lines don't contain shef binary anymore.
Those lines are run all they all have been added.
Lines that execute successfully get marked as `[x]`, those that fail are
marked `[!]`, those that are successfully rolled back `[o]`, those that
are skipped `[-]`.
Lines are checked for valid shef resources.

 Refactor
------------------

- **awk**: transform build output from statements to queue entries
- **awk**: remove the shef binary from the awk output
- **eval**: echo content of STDERR or STDOUT depending on the situation
- **shef**: forward `SHEF_QUIET`, `SHEF_VERBOSE` and `SHEF_VERY_VERBOSE`
env variable values if variables are set

 Tests
---------------

- **docker**: mount /tmp directory as a volume into host's var and gitignore
it
- **assert**: add an assert_file_is_empty assertion
- **build**: adding a test representing the current build output for a recipe
- **assert**: remove unwanted spaces from custom diff
- **docker**: add /code/libexec path to system PATH

🔧 Chore
--------------

- **build**: remove useless OUTPUT variable
- **directory**: the directory resource now prints a success message if the directory already exists

🤔 TIL
--------------

- If a bash condition on assigning a command substitution result to a variable
is negated, the value in `$?` seems to be always `0`

```sh
if ! OUT=$(my_command); then
    echo "$?"
    echo -e "$OUT"
fi

// Will display 0 and the result of the command substitution

if OUT=$(my_command); then
    //
else
    echo "$?"
    echo -e "$OUT"
fi

// Will display the correct exit code and the result of the command substitution
```

🔗 Links
------------

- Closes #114
parent db6eb3d5
Pipeline #190720624 passed with stages
in 5 minutes and 43 seconds