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 200d297..32c0a09 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.cvillecsteele/lein-git-version "1.0.1" +(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/lein_git_version/plugin.clj b/src/lein_git_version/plugin.clj index 19e37b9..aa9e8aa 100644 --- a/src/lein_git_version/plugin.clj +++ b/src/lein_git_version/plugin.clj @@ -3,17 +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"))] - (-> project - (update-in [:injections] concat `[(spit ~filename ~code)]) - (assoc :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)))) diff --git a/src/leiningen/git_version.clj b/src/leiningen/git_version.clj index b043c5c..16375dd 100644 --- a/src/leiningen/git_version.clj +++ b/src/leiningen/git_version.clj @@ -9,12 +9,8 @@ (:use [clojure.java.shell :only [sh]])) -(defn get-git-version - [] - (apply str (rest (clojure.string/trim - (:out (sh - "git" "describe" "--match" "v*.*" - "--abbrev=4" "--dirty=**DIRTY**")))))) +(defn get-git-version [] + (clojure.string/trim (:out (sh "git" "describe" "--dirty")))) (defn git-version "Show project version, as tagged in git."