File tree Expand file tree Collapse file tree
lein_git_version_generate Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22/lib
33/classes
44/checkouts
5+ .idea
56pom.xml
67* .jar
78* .class
89.lein-deps-sum
910.lein-failures
10- .lein-plugins
11+ .lein-plugins
12+ * .iml
Original file line number Diff line number Diff line change 44 clojure.pprint
55 [leiningen.git-version :only [git-version]]))
66
7- (defn wrap-with-hook [f & args]
8- (do
9- (apply git-version args)
10- (apply f args)))
7+ (defn wrap-with-hook [f & args]
8+ (do
9+ (try
10+ (apply git-version args)
11+ (catch Exception e (println " lein-git-version plugin: exception " (.getMessage e))))
12+ (apply f args)))
1113
1214(defn hooks []
1315 (robert.hooke/add-hook #'leiningen.compile/compile #'wrap-with-hook))
Original file line number Diff line number Diff line change 1010 (:use
1111 [clojure.java.shell :only [sh]]))
1212
13+ (defn shcall [& args]
14+ (let [{exit :exit out :out err :err } (apply sh args)
15+ exitcode (clojure.string/trim (str exit))]
16+ (when-not (= " 0" exitcode) (println " lein-git-version plugin: sh call " args " exit code " exitcode " error " err))
17+ (apply str (rest (clojure.string/trim out)))))
18+
1319(defn get-git-version
1420 []
15- (apply str (rest (clojure.string/trim
16- (:out (sh
17- " git" " describe" " --match" " v*.*"
18- " --abbrev=4" " --dirty=**DIRTY**" ))))))
21+ (shcall " git" " describe" " --match" " v*.*" " --abbrev=4" " --dirty=**DIRTY**" ))
1922
2023(defn get-git-ref
2124 []
22- (apply str (clojure.string/trim
23- (:out (sh
24- " git" " rev-parse" " --verify" " HEAD" )))))
25+ (shcall " git" " rev-parse" " --verify" " HEAD" ))
2526
2627(defn get-git-status
2728 []
28- (apply str (clojure.string/trim
29- (:out (sh
30- " git" " status" " --porcelain" )))))
29+ (shcall " git" " status" " --porcelain" ))
3130
3231; (defn git-version
3332; "Show project version, as tagged in git."
You can’t perform that action at this time.
0 commit comments