From af19a89f921613c2fd1b5129ac4b72912a31b715 Mon Sep 17 00:00:00 2001 From: Brendan Younger Date: Fri, 18 Jul 2014 13:52:17 -0400 Subject: [PATCH 1/5] Force writing of version.clj file --- project.clj | 2 +- src/lein_git_version/plugin.clj | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index 200d297..b1d5288 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.cvillecsteele/lein-git-version "1.0.1" +(defproject org.clojars.cvillecsteele/lein-git-version "1.0.2" :description "Use git for project versions" :url "https://github.com/cvillecsteele/lein-git-version" :license {:name "Eclipse Public License" diff --git a/src/lein_git_version/plugin.clj b/src/lein_git_version/plugin.clj index 19e37b9..48f4970 100644 --- a/src/lein_git_version/plugin.clj +++ b/src/lein_git_version/plugin.clj @@ -14,6 +14,5 @@ (str (:git-version-path project) "/version.clj") (str (or (first (:source-paths project)) "src") "/" proj-dir "/version.clj"))] - (-> project - (update-in [:injections] concat `[(spit ~filename ~code)]) - (assoc :version (get-git-version))))) + (spit filename code) + (assoc project :version (get-git-version)))) From c663e6f8c4be27ae7483562c955284161899f0ea Mon Sep 17 00:00:00 2001 From: Brendan Younger Date: Fri, 18 Jul 2014 14:00:47 -0400 Subject: [PATCH 2/5] Change to my clojars group --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index b1d5288..61141f9 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.cvillecsteele/lein-git-version "1.0.2" +(defproject org.clojars.brendanyounger/lein-git-version "1.0.2" :description "Use git for project versions" :url "https://github.com/cvillecsteele/lein-git-version" :license {:name "Eclipse Public License" From 710e9962a31c6fb36a49a223a58a18327016ce2f Mon Sep 17 00:00:00 2001 From: Brendan Younger Date: Fri, 18 Jul 2014 14:08:04 -0400 Subject: [PATCH 3/5] Cache git version --- project.clj | 2 +- src/lein_git_version/plugin.clj | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/project.clj b/project.clj index 61141f9..3631d26 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.brendanyounger/lein-git-version "1.0.2" +(defproject org.clojars.brendanyounger/lein-git-version "1.0.3" :description "Use git for project versions" :url "https://github.com/cvillecsteele/lein-git-version" :license {:name "Eclipse Public License" diff --git a/src/lein_git_version/plugin.clj b/src/lein_git_version/plugin.clj index 48f4970..aa9e8aa 100644 --- a/src/lein_git_version/plugin.clj +++ b/src/lein_git_version/plugin.clj @@ -3,16 +3,16 @@ clojure.pprint [leiningen.git-version :only [get-git-version]])) -(defn middleware - [project] - (let [code (str - ";; Do not edit. Generated by lein-git-version plugin.\n" - "(ns " (:name project) ".version)\n" - "(def version \"" (get-git-version) "\")\n") - proj-dir (.toLowerCase (.replace (:name project) \- \_)) - filename (if (:git-version-path project) - (str (:git-version-path project) "/version.clj") - (str (or (first (:source-paths project)) "src") "/" - proj-dir "/version.clj"))] - (spit filename code) - (assoc project :version (get-git-version)))) +(let [version (get-git-version)] + (defn middleware [project] + (let [code (str + ";; Do not edit. Generated by lein-git-version plugin.\n" + "(ns " (:name project) ".version)\n" + "(def version \"" version "\")\n") + proj-dir (.toLowerCase (.replace (:name project) \- \_)) + filename (if (:git-version-path project) + (str (:git-version-path project) "/version.clj") + (str (or (first (:source-paths project)) "src") "/" + proj-dir "/version.clj"))] + (spit filename code) + (assoc project :version version)))) From 73ce214d88bd353f76e142fdc8ec31299690311d Mon Sep 17 00:00:00 2001 From: Brendan Younger Date: Tue, 23 Sep 2014 22:13:03 -0400 Subject: [PATCH 4/5] Adjust version format to not include * in dirty commits --- .gitignore | 3 ++- project.clj | 2 +- src/leiningen/git_version.clj | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2c811ef..947cbbe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,9 @@ /classes /checkouts pom.xml +pom.xml.asc *.jar *.class .lein-deps-sum .lein-failures -.lein-plugins \ No newline at end of file +.lein-plugins diff --git a/project.clj b/project.clj index 3631d26..832006a 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.brendanyounger/lein-git-version "1.0.3" +(defproject org.clojars.brendanyounger/lein-git-version "1.0.4" :description "Use git for project versions" :url "https://github.com/cvillecsteele/lein-git-version" :license {:name "Eclipse Public License" diff --git a/src/leiningen/git_version.clj b/src/leiningen/git_version.clj index b043c5c..268d8ae 100644 --- a/src/leiningen/git_version.clj +++ b/src/leiningen/git_version.clj @@ -12,9 +12,7 @@ (defn get-git-version [] (apply str (rest (clojure.string/trim - (:out (sh - "git" "describe" "--match" "v*.*" - "--abbrev=4" "--dirty=**DIRTY**")))))) + (:out (sh "git" "describe" "--dirty")))))) (defn git-version "Show project version, as tagged in git." From f22f3da40127a33af14195e4833bbab247083307 Mon Sep 17 00:00:00 2001 From: Brendan Younger Date: Fri, 26 Sep 2014 20:30:53 -0400 Subject: [PATCH 5/5] Keep the leading 'v' on the version --- project.clj | 2 +- src/leiningen/git_version.clj | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/project.clj b/project.clj index 832006a..32c0a09 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.brendanyounger/lein-git-version "1.0.4" +(defproject org.clojars.brendanyounger/lein-git-version "1.0.5" :description "Use git for project versions" :url "https://github.com/cvillecsteele/lein-git-version" :license {:name "Eclipse Public License" diff --git a/src/leiningen/git_version.clj b/src/leiningen/git_version.clj index 268d8ae..16375dd 100644 --- a/src/leiningen/git_version.clj +++ b/src/leiningen/git_version.clj @@ -9,10 +9,8 @@ (:use [clojure.java.shell :only [sh]])) -(defn get-git-version - [] - (apply str (rest (clojure.string/trim - (:out (sh "git" "describe" "--dirty")))))) +(defn get-git-version [] + (clojure.string/trim (:out (sh "git" "describe" "--dirty")))) (defn git-version "Show project version, as tagged in git."