-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.boot
75 lines (62 loc) · 2.35 KB
/
build.boot
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
(set-env! :resource-paths #{"src" "dev"}
:dependencies '[]
:repositories
(partial map (fn [[k v]] [k (cond-> v (#{"clojars"} k) (assoc :username (System/getenv "CLOJARS_USER"),
:password (System/getenv "CLOJARS_PASS")))])))
(require '[boot-fmt.core :refer [fmt]])
(task-options! pom
{:project 'boot-fmt/boot-fmt,
:description "Boot task to auto-format Clojure(Script) code",
:url "https://github.com/pesterhazy/boot-fmt",
:scm {:url "https://github.com/pesterhazy/boot-fmt"},
:license {"Eclipse Public License"
"http://www.eclipse.org/legal/epl-v10.html"}}
fmt
{:mode :diff
:options {:style :community}})
(defn get-version []
(read-string (slurp "release.edn")))
(defn format-version [{:keys [version]}]
(clojure.string/join "." version))
;!zprint {:format :skip}
(deftask dogfood
"Reformat this very repository"
[m mode MODE kw "mode"
r really bool "really"]
(fmt :mode (or mode :diff)
:source true
:really really))
(defn replace-help [outer inner]
(clojure.string/replace outer
#"(?m)(?s)(<!-- begin help -->)(.*)(<!-- end help -->)$"
(fn [[_ a b c]] (str a "\n\n```\n" inner "\n```\n" c))))
(deftask update-help []
(with-pass-thru [_]
(->> (replace-help (slurp "README.md") (with-out-str (boot.core/boot "fmt" "-h")))
(spit "README.md"))))
(deftask bump
[]
(with-pass-thru [_]
(let [version (update-in (get-version) [:version 2] inc)]
(boot.util/info "Bumped to version: %s\n" (format-version version))
(spit "release.edn" version))))
(deftask build [] (comp (pom :version (format-version (get-version))) (jar) (install)))
(deftask deploy
[]
(comp (build)
(push :repo
"clojars"
:gpg-sign
false)))
(deftask confirm []
(with-pass-thru [_]
(println)
(print "Enter \"Yes\" (without the quotes) to continue: ")
(flush)
(when (not= (read-line) "Yes")
(throw (ex-info "Interrupted" {})))))
(deftask release []
(comp (update-help)
(dogfood :mode :overwrite :really true)
(confirm)
(deploy)))