-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbb.edn
41 lines (41 loc) · 2.28 KB
/
bb.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{:paths ["src"]
:deps {org.clojars.askonomm/ruuter {:mvn/version "1.3.3"}}
:pods {org.babashka/go-sqlite3 {:version "0.1.0"}}
:tasks {:requires ([babashka.fs :as fs])
:init (def jar-name "todos.jar")
test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:task (exec 'cognitect.test-runner.api/test)
:exec-args {:dirs ["test"]}}
start {:doc "Start the server locally"
:task (shell {:continue true} "bb -m todos.main")}
repl {:requires ([babashka.nrepl.server :as srv])
:task (let [port (with-open [s (java.net.ServerSocket. 0)] (.getLocalPort s))
port-file ".nrepl-port"]
(srv/start-server! {:host "localhost" :port port})
(spit port-file (str port))
(fs/delete-on-exit port-file)
(deref (promise)))}
jar {:doc "Build an uberjar"
:task (if (seq (fs/modified-since jar-name ["src/"]))
(shell (format "bb uberjar %s -m todos.main" jar-name))
(println "jar up to date"))}
image {:doc "Build a container image"
:depends [jar]
:task (let [engine (->> ["podman" "docker"]
(map fs/which)
(some (fn [e] (when e e))))]
(println "using engine:" (str engine))
(when-not engine
(throw (ex-info "Podman or Docker not found." {:babashka/exit 1})))
(shell (str engine " build -t docker.io/clojurestream/todo .")))}
clean {:doc "Cleanup"
:task (do (fs/delete-if-exists jar-name)
(fs/delete-if-exists "todos.sqlite")
(fs/delete-tree "target"))}
cli {:doc "Run the CLI"
:extra-paths ["cli"]
:requires ([todos.cli :as cli])
:extra-deps {io.github.lispyclouds/bblgum {:git/sha "f0561e6f8e430f2fbbd3f4093947dfdf6896e7e5"}
doric/doric {:mvn/version "0.9.0"}}
:task (cli/-main *command-line-args*)}}}