Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not sign tags when running "vcs" "tag" #1986

Merged
merged 1 commit into from Sep 10, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+39 −6
Diff settings

Always

Just for now

Add option to not sign tags when running "vcs" "tag"

- Add vcs tag commandline argument parser
- Update documentation to show new options

Fixes #1873, fixes #1799
  • Loading branch information...
danielcompton committed Sep 10, 2015
commit eb98e855cfe57acc10a69e19f58b3c07af354615
Copy path View file
@@ -297,6 +297,13 @@ libraries using Leiningen. Applications will have different requirements
that are varied enough that Leiningen doesn't attempt to support them
out of the box.
### Tagging
By default `["vcs" "tag"]` will create a GPG signed tag with your project version
number. You can add a tag prefix by passing the prefix after `"tag"`,
for example: `["vcs" "tag" "v"]`. You can disable tag signing by passing `--no-sign`,
for example: `["vcs" "tag" "v" "--no-sign"]` or `["vcs" "tag" "--no-sign"]`.
## Deploying to Maven Central
Deploying your libraries and other artifacts to [Maven
Copy path View file
@@ -16,7 +16,15 @@
(defn which-vcs [project & _]
(or (:vcs project) (some (partial uses-vcs project) @supported-systems)))


(defn parse-tag-args [args]
(loop [parsed-args {:sign? true}
args args]
(case (first args)
("--sign" "-s") (recur (assoc parsed-args :sign? true) (rest args))
"--no-sign" (recur (assoc parsed-args :sign? false) (rest args))
nil parsed-args ;; We're finished and can exit
(recur (assoc parsed-args :prefix (first args)) (rest args)))))

;;; Methods

(defmulti push "Push to your remote repository."
@@ -31,7 +39,6 @@
(defmulti assert-committed "Abort if uncommitted changes exist."
which-vcs :default :none)



;;; VCS not found

@@ -48,6 +55,7 @@

(defmethod assert-committed :none [project] (unknown-vcs "assert-committed"))


;;; Git

(defmethod push :git [project & args]
@@ -59,12 +67,15 @@
(binding [eval/*dir* (:root project)]
(eval/sh-with-exit-code "Couldn't commit" "git" "commit" "-a" "-m" (str "Version " (:version project)))))

(defmethod tag :git [{:keys [root version]} & [prefix]]
(defmethod tag :git [{:keys [root version]} & args]
(binding [eval/*dir* root]
(let [tag (if prefix
(let [{:keys [sign? prefix]} (parse-tag-args args)
tag (if prefix
(str prefix version)
version)]
(eval/sh-with-exit-code "Couldn't tag" "git" "tag" "-s" tag "-m" (str "Release " version)))))
version)
cmd (->> ["git" "tag" (when sign? "--sign") tag "-m" (str "Release " version)]
(filter some?))]
(apply eval/sh-with-exit-code "Couldn't tag" cmd))))

(defmethod assert-committed :git [project]
(binding [eval/*dir* (:root project)]
Copy path View file
@@ -0,0 +1,15 @@
(ns leiningen.test.vcs
(:require [clojure.test :refer :all]
[leiningen.vcs :as vcs]))

(deftest parsed-args
(testing "VCS tag argument parsing"
(are [args parsed-args] (= (vcs/parse-tag-args args) parsed-args)
[] {:sign? true}
["v"] {:prefix "v" :sign? true}
["v" "--sign"] {:prefix "v" :sign? true}
["--sign"] {:sign? true}
["--no-sign"] {:sign? false}
["--no-sign" "v"] {:prefix "v" :sign? false}
["-s"] {:sign? true}
["v" "r"] {:prefix "r" :sign? true})))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.