This repository has been archived by the owner on May 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy.clj
36 lines (32 loc) · 1.52 KB
/
deploy.clj
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
(ns trident.build.deploy
(:require [trident.cli :refer [help main-fn]]
[trident.build.pom :refer [sync-pom]]
[trident.build.jar :refer [jar]]
[trident.build.lib :refer [cli-options jar-file]]
[deps-deploy.deps-deploy :as deps-deploy]
[clojure.string :as str]))
(defn ^:no-doc deps-task [command {:keys [skip-jar] :as opts}]
(assert (contains? #{"install" "deploy"} command))
(when (not skip-jar)
(println "generating pom")
(sync-pom opts)
(println "packaging")
(jar opts))
(deps-deploy/-main command (jar-file opts)))
(defn ^:no-doc subcommand [cmd desc]
{:fn (partial deps-task cmd)
:prog (str "clj -m trident.build.deploy " cmd)
:desc (conj desc (str "Packages the jar first by default. The jar path is "
"`target/<artifact-id>-<version>.jar`."))
:config :trident/lib
:options cli-options
:option-keys [:group-id :artifact-id :version :github-repo :skip-jar]})
(let [install-cmd (subcommand "install" ["Installs a library to the local maven repo."])
deploy-cmd (subcommand "deploy"
["Deploys a library to Clojars."
(str "The environment variables `CLOJARS_USERNAME` and "
"`CLOJARS_PASSWORD` must be set.")])]
(def cli {:prog "clj -m trident.build.deploy"
:subcommands {"install" install-cmd "deploy" deploy-cmd}})
(def ^{:doc (str/join "\n\n" (map help [cli install-cmd deploy-cmd]))}
-main (main-fn cli)))