babashka/test-resources/bb.edn
Michiel Borkent 8f93826072 wip
2021-03-19 12:14:04 +01:00

55 lines
2.7 KiB
Clojure

{:paths ["test-resources/bb-edn"] ;; no-brainer to support this
:deps {medley/medley {:mvn/version "1.3.0"}} ;; no-brainer to support this
;; here comes the part that is currently uncertain
:tasks {:count-files {:task/type :shell
:args ["bash" "-c" "ls | wc -l"]}
:bash {:task/type :babashka
:args [:invoke user/bash]}
:eval-plus {:task/type :babashka
:args [-e (apply + (map (fn [i]
(Integer/parseInt i))
*command-line-args*))]}
:describe {:task/type :babashka
:args [:clojure -Sdescribe]}
:do-bash {:task/type :babashka
:args [:do :bash "ls | wc -l"
:__ :eval-plus 1 2 3]}
:all {:task/type :babashka
:args [:do :count-files
:__ :bash "ls | wc -l"
:__ :eval-plus 1 2 3
:__ :describe]}
;;;;
:never-failing-shell
{:task/type :babashka
;; we are executing a shell task, yet we are continueing despite the error code
:args [-e (-> (do (deref (babashka.process/process ["ls" "foobar"] {:inherit true}))
(deref (babashka.process/process ["echo" "done"] {:inherit true}))
nil))]}
:print-hello {:task/type :babashka
:args [-e (println :hello)]}
:always-failing-shell
{:task/type :babashka
;; we are executing a shell task, yet we are continueing despite the error code
:args [-e (babashka.process/check (babashka.process/process ["ls" "foobar"] {:inherit true}))]}
:composed-never-failing {:task/type :babashka
:args [:do :never-failing-shell
:__ :print-hello]}
:composed-failing {:task/type :babashka
:args [:do :always-failing-shell
:__ :print-hello]}
,
;;;; context (not implemented)
;; the problem with this is the DSL nature which is very opiniated and
;; maybe not so nice to learn for people who only want to write Clojure
:put-answer-in-ctx {:type/task :babashka
:args [:eval-plus 1 2 3]
:out [:answer]}
:print-answer {:type/task :babashka
:in {:sum [:answer]}
:args [-e (println $sum)]}
}
}