          '[edge.system :refer [new-system]])
 
 (def repl-port 5600)
-(def version "0.1.0-SNAPSHOT")
 
 (task-options!
  repl {:client true
        :port repl-port}
- pom {:project 'edge
+ pom {:project (symbol project)
       :version version
       :description "A complete Clojure project you can leap from"
       :license {"The MIT License (MIT)" "http://opensource.org/licenses/mit-license.php"}}
  aot {:namespace #{'edge.main}}
  jar {:main 'edge.main
-      :file (str "edge-" version "-standalone.jar")})
+      :file (str project "-" version "-standalone.jar")})
 
 (deftask dev-system
   "Develop the server backend. The system is automatically started in

   (uber)
   (jar)
   (target)))

;; (e.g. CIDER).

;; See README.md for more details.

(require '[clojure.java.shell :as sh])

(defn next-version [version]
  (when version
    (let [[a b] (next (re-matches #"(.*?)([\d]+)" version))]
      (when (and a b)
        (str a (inc (Long/parseLong b)))))))

(defn deduce-version-from-git
  "Avoid another decade of pointless, unnecessary and error-prone
  fiddling with version labels in source code."
  []
  (let [[version commits hash dirty?]
        (next (re-matches #"(.*?)-(.*?)-(.*?)(-dirty)?\n"
                          (:out (sh/sh "git" "describe" "--dirty" "--long" "--tags" "--match" "[0-9].*"))))]
    (cond
      dirty? (str (next-version version) "-" hash "-dirty")
      (pos? (Long/parseLong commits)) (str (next-version version) "-" hash)
      :otherwise version)))

(def project "edge")
(def version (deduce-version-from-git))

(set-env!
 :source-paths #{"sass" "src"}
