/ bb.edn
bb.edn
 1  {:tasks 
 2   {test
 3    {:doc "run tests in batch mode"
 4     :requires ([babashka.process :as p]
 5                [babashka.fs :as fs])
 6     :task (let [devenv-elpa-libs (str (System/getenv "DEVENV_PROFILE") "/share/emacs/site-lisp/elpa/")
 7                 devenv-elpa-libs (map str (fs/list-dir devenv-elpa-libs))
 8                 load-path-args (mapcat (fn [path] ["-L" path]) devenv-elpa-libs)
 9                 result (apply p/sh {:out :inherit :err :inherit}
10                               (concat ["emacs" "-Q" "--batch"]
11                                       load-path-args
12                                       ["-l" "dev.el"]
13                                       ["-l" "nx-test.el"]
14                                       ["-f" "ert-run-tests-batch-and-exit"]))]
15             (System/exit (:exit result)))}
16  
17    portal
18    {:doc "launches portal data viewer in standalone mode - pair with 'tap' task to visualize data"
19     :extra-deps {djblue/portal {:mvn/version "LATEST"}}
20     :requires ([portal.api :as p]
21                [portal.runtime :as p.rt])
22     :task (do
23             (portal.api/open {:port 53755})
24             (Thread/sleep 3000)  ; warm-up
25             (future (while true
26                       (when (nil? (p.rt/active-sessions))
27                         (System/exit 0))
28                       (Thread/sleep 500)))
29             (deref (promise)))}
30  
31    tap
32    {:doc "reads EDN from stdin and submits to Portal instance"
33     :extra-deps {djblue/portal {:mvn/version "LATEST"}}
34     :requires ([portal.client.jvm :as p]
35                [clojure.edn :as edn])
36     :task (->> *in* slurp edn/read-string (p/submit {:port 53755}))}}}