Skip to content

Instantly share code, notes, and snippets.

@frankiesardo
Created September 10, 2015 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankiesardo/70539b34f442d15eb453 to your computer and use it in GitHub Desktop.
Save frankiesardo/70539b34f442d15eb453 to your computer and use it in GitHub Desktop.
(require '[clojure.java.shell :as shell]
'[clojure.string :as str])
(defn- current-tag []
(let [{:keys [exit out]} (shell/sh "git" "describe" "--tags")]
(when (zero? exit)
(str/trim out))))
(def version
(if-let [tag (current-tag)]
(cond-> (second (re-find #"v(.*)" tag))
(.contains tag "-") (str "-SNAPSHOT"))
"0.1.0-SNAPSHOT"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment