mattly/bork — pull request #7 by mattly (2014-04-23 20:43:46+00:00)
Title: cleanup, redefine the role of bake

"bake" used to serve a few purposes:

- run given commands in a sub-shell
- tell the script to exit on failure
- handle directory changing
- handle sudo user wrapping
- serve as an entry point for testing

But, bake was used exclusively by the `install` or `update` actions, not `status`

upon some rethinking, I realized that those should be teased out a bit. So, with this branch:

The assertion runner (ie, `git`) is run in a sub-shell. Want to change directories and not have to worry about cleanup? go for it.

Bake is now a way to forward to "eval" and much more. It's still useful for testing (as the new `respond_to` mock thing shows) but I'm thinking that script maintainers could overwrite the function if they want with additional functionality: prompting, running on a remote machine, etc. In an assertion handler, **anything where you're querying or changing the state of the target system should be run through bake**. Logic on those results can still happen outside of bake.

Anyway, gonna sit on this a day or so before merging.