Created
March 17, 2021 08:30
-
-
Save helins/de21872849d4149282dbcfeec49a41bf to your computer and use it in GitHub Desktop.
Interceptor-like twist for a Babashka task runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; For instance, build tasks produce garbage and an interceptor-like interface is a great match | |
;; | |
{:tasks {:build-something {:enter {:babashka/process ["bash" "-c" "touch file.txt"]} | |
:leave {:babashka/process ["bash" "-c" "rm file.txt"]}}}} | |
;; Clearer than splitting the task in two | |
;; | |
{:tasks {:create-file {:babashka/process ["bash" "-c" "touch file.txt"]} | |
:delete-file {:babashka/process ["bash" "-c" "rm file.txt"]} | |
:build-something {:babashka/args [:do :create-file | |
:do :delete-file]}}} | |
;; More importantly, execution semantics could differ between :enter and :leaver | |
;; | |
;; Eg. Fail fast on :enter cycle (important tasks, all should succeed), just issue warning when task fails | |
;; in :leave cycle (since it's juste garbage cleaning and nothing crucial). | |
;; | |
;; Deserves more thought but acknowledging different phases with possibly different execution semantics would | |
;; be the dream declarative task runner as far as I am concerned. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment