-
Notifications
You must be signed in to change notification settings - Fork 7
/
bb.edn
80 lines (75 loc) · 4.81 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{:min-bb-version "0.9.162"
:paths ["."]
:deps {escherize/bask {:git/url "https://github.com/escherize/bask.git"
:git/sha "81cc9af3021d7689cfbddf0518a1e828f785f006"}
table/table {:mvn/version "0.5.0"}}
:tasks {:requires [[babashka.process :refer [shell]]
[bask.colors :as c]
[bb.cli :as cli]
[bb.tasks :as t]
[clojure.string :as str]]
metabuild
{:doc "Starts metabase locally in dev mode. Set FORCE_MB_DB_CONNECTION_URI to override connection string building"
:requires [[bb.meta :as meta]]
:examples [["FORCE_MB_DB_CONNECTION_URI=mysql://localhost:3308/metabase_test?user=root bb metabuild -d mysql"
"Connect to MYSQL, running against run-mariadb-latest.sh"]]
:task (let [_ (println (c/red "Welcome to " (c/on-white (c/blue " MetaBuilder "))))
{:keys [app-db user-name password extensions db-name] :as p}
(cli/menu! (current-task)
{:id :app-db
:short "-d"
:long "--database-type DB"
:title "Pick Metabase's app-db"
:choices ["postgres" "h2" "mysql"]
:prompt :select}
{:id :user-name :short "-u" :long "--username USER" :default (t/whoami)}
{:id :password :short "-p" :long "--pw PW" :default "password"}
{:id :extensions :short "-e" :long "--extensions EXT" :default ["dev" "ee" "ee-dev" "drivers" "drivers-dev" "nrepl"] :prompt :multi}
{:id :db-name
:short "-n"
:long "--name DB_NAME"
:default "metabase"
:title "Name of the database to connect to."
:prompt :text})]
;; (prn p)
(meta/build app-db user-name password extensions db-name))}
quick-test
{:doc "Quickly run a test against a namespace."
:requires [[bb.quick-test :as qt]]
:task (qt/go!
(:test-namespaces (cli/menu! (current-task)
{:id :test-namespaces
:msg "What namespace(s) to test?"
:long "--ns NS"
:prompt :multi
:choices (delay (qt/test-nss))
:choices-doc "a list of clojure test namespaces"})))}
watch-ci
{:doc "Prints the command to watch your CI build for a specific branch."
:task (println
(str/join "\n" ["To watch your branch, cd to metabase, switch to your branch, and run:"
""
"gh pr checks --watch --required && say done"
""]))}
github-bookmarklet
{:doc "Print info about Tim's Amazing Github Bookmarklet."
:task (println
(str/join "\n"
["Save this as a bookmarklet, and click it on a github page to remove passing tests:"
""
"javascript:%20document.querySelectorAll(%22.merge-status-item%20.octicon-check,.octicon-skip%22).forEach((el)%20=%3E%20el.parentElement.parentElement.remove())"
""]))}
install-autotab {:doc "Prints shell code to autocomplete tasks using bb.
Note: for fish shell please make sure ~/.config/fish/completions exists."
:examples [["bb install-autotab --shell bash >> ~/.bashrc" "Bash ^"]
["bb install-autotab --shell zsh >> ~/.zshrc" "Zsh ^"]
["bb install-autotab --shell fish >> ~/.config/fish/completions/bb.fish" "Fish ^"]]
:task (let [{:keys [shell-type] :as x}
(cli/menu! (current-task)
{:id :shell-type
:long "--shell SHELL"
:title "What kind of shell?"
:choices ["zsh" "bash" "fish"]
:prompt :select})]
(println (str "\n# --- bb autocomplete follows ---\n"
(slurp (str "./bb/" shell-type "_completion.sh")))))}}}