diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0d4dc8..3fd2955a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ Babashka: - Sort tasks in `bb tasks` output +Experimental: + +- Add `bb run --parallel ` +- Fix `:init` in `:tasks` + Deps.clj: - Fix arg parsing when invoking from Powershell [#42](https://github.com/borkdude/deps.clj/issues/42) diff --git a/src/babashka/impl/tasks.clj b/src/babashka/impl/tasks.clj index 41bcab09..9e9f2e65 100644 --- a/src/babashka/impl/tasks.clj +++ b/src/babashka/impl/tasks.clj @@ -133,7 +133,7 @@ task (get tasks task-name)] (if task (let [m? (map? task) - init (and m? (get tasks :init)) + init (get tasks :init) prog (if-let [depends (when m? (:depends task))] (let [targets (target-order tasks task-name)] (loop [prog "" @@ -154,7 +154,9 @@ [[(format-task init prog)] nil]) [(binding [*out* *err*] (println "No such task:" task-name)) 1]))))) - [[(format-task init (assemble-task-1 task-name task parallel? true))] nil])] + [[(format-task + init + (assemble-task-1 task-name task parallel? true))] nil])] (when (= "true" (System/getenv "BABASHKA_DEV")) (println (ffirst prog))) prog) diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index fd19609e..f47a44fc 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -60,6 +60,10 @@ (bb "foo") (is (= "quux\nbaz\nbar\nfoo\n" (slurp out))))) (fs/delete out) + (testing "init test" + (test-utils/with-config '{:tasks {:init (def x 1) + foo x}} + (is (= 1 (bb "foo"))))) ;; Note: this behavior with :when was complex, since the place where :when ;; is inserted isn't very intuitive here ;; This is why we don't support :when for now