Execution Order of Formulas
October 8, 2015 ยท View on GitHub
The way that Wick loads and runs formulas can be a bit tricky to diagnose if you don't understand what's going on. This document will give you the order of events and the reason behind why those events are happening in this order.
See the parents documentation for more information about the hierarchical order in which each item is loaded. For instance, the library functions load the top most ancestor and works its way down through the children.
-
Libraries are loaded. They don't have any dependencies other than themselves and they don't care about the order in which they are loaded.
-
Binaries are loaded. They rely on functions that
wickexposes and can use the functions in the libraries. There is a special hook that they can use to call functions after all binaries have been sourced into the environment. The help system relies on this hook. -
A command is executed. Each command gets its own section.
wick help
Nothing more is loaded for the help system. This merely writes out messages to stdout. (See Bash concepts for stdout.)
wick run
- Execute each of the roles. Each role will load more roles or use
wickFormulato load formulas. wickFormulawill do the following:- Make sure the formula is not already in the list of formulas to load.
- Run the
dependsfile to pick up additional formulas that need to be loaded before this formula. This callswickFormulaand is recursive. - Add the formula's
runscript if one exists. - Loads all functions for the formula.
- Run all explorers for the formula with wickExplorer.
- For each of the formulas that need to run:
- Set up a clean subshell.
- Run the formula's
runscript.