Skip to content

Commit d953507

Browse files
committed
cleanup
1 parent 697a7c6 commit d953507

File tree

4 files changed

+7
-30
lines changed

4 files changed

+7
-30
lines changed

bb.edn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
watch-ci
7171
{:requires [[bb.dl-and-run :as dl]
72-
[clojure.pprint :as pp]]
72+
[bb.watch-ci :as watch-ci]]
7373
:doc "Watch the CI status for a branch until it passes."
7474
:examples [["bb watch-ci --branch current" "Check currently checked out branch in MB_DIR repo"]]
7575
:task
@@ -79,15 +79,15 @@
7979
:msg "What branch should we check?"
8080
:short "-b"
8181
:long "--branch BRANCH"
82-
:choices (delay (t/list-branches (t/mb-env)))
82+
:choices (delay (t/list-branches (t/mb-dir)))
8383
:choices-doc "list of branches"
8484
:prompt :select})
8585
branch (if (= "current" branch)
8686
(let [current (t/current-branch)]
8787
(do (println (c/green (c/bold "Using current branch: " (t/current-branch))))
8888
current))
8989
branch)]
90-
(bb.watch-ci/branch branch)))}
90+
(watch-ci/branch branch)))}
9191

9292
install-autotab {:doc "Prints shell code to autocomplete tasks using bb.
9393
Note: for fish shell please make sure ~/.config/fish/completions exists."

bb/dl_and_run.clj

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
[bb.tasks :as t]
77
[cheshire.core :as json]
88
[clojure.edn :as edn]
9-
[clojure.string :as str]
109
[selmer.parser :refer [<<]]))
1110

1211
(defn- keep-first
1312
"like (fn [f coll] (first (keep f coll))) but does not do chunking."
1413
[f coll]
1514
(reduce (fn [_ element] (when-let [resp (f element)] (reduced resp))) nil coll))
1615

17-
(defn- gh-get [url]
16+
(defn gh-get [url]
1817
(try (-> url
1918
(curl/get {:headers {"Accept" "application/vnd.github+json"
2019
"Authorization" (str "Bearer " (t/env "GH_TOKEN"))}})
@@ -141,20 +140,3 @@
141140
(defn download-and-run-latest-jar! [{:keys [branch port socket-repl] :as args}]
142141
(let [info (download-latest-jar! args)]
143142
(run-jar! info port socket-repl)))
144-
145-
(def pretty {:success ""
146-
:skipped "⏭️ "
147-
:cancelled "⏹️"
148-
:in-progress "🔄"
149-
:failure ""})
150-
151-
(defn checks-for-branch [branch]
152-
;; note: this is a ref, so it can e.g. also be a sha.
153-
(->> (str "https://api.github.com/repos/metabase/metabase/commits/" branch "/check-runs")
154-
gh-get
155-
:check_runs
156-
(mapv :conclusion)
157-
(mapv (fn [x] (if (nil? x) :in-progress (keyword x))))
158-
frequencies
159-
(sort-by first)
160-
reverse))

bb/quick_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
[bb.tasks :as t]
77
[clojure.string :as str]))
88

9-
(defn- test-path [] (str (t/mb-env) "/test"))
9+
(defn- test-path [] (str (t/mb-dir) "/test"))
1010

1111
(defn- file->ns [path]
1212
(-> path
1313
str
14-
(str/replace (str (t/mb-env) "/test/") "")
14+
(str/replace (str (t/mb-dir) "/test/") "")
1515
(str/replace #"\.clj$" "")
1616
(str/replace "_" "-")
1717
(str/replace "/" ".")))

bb/watch_ci.clj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
(ns bb.watch-ci
2-
(:require [babashka.process :refer [shell]]
3-
[bask.colors :as c]
4-
[bb.cli :as cli]
5-
[bb.tasks :as t]
6-
[clojure.string :as str]
2+
(:require [clojure.string :as str]
73
[bb.dl-and-run :as dl]
8-
[clojure.pprint :as pp]
94
[table.core :as table]))
105

116
(defn checks-for-branch [branch]

0 commit comments

Comments
 (0)