Skip to content

Commit

Permalink
Make /about/version slightly more friendly if anyone runs 4clojure fr…
Browse files Browse the repository at this point in the history
…om something other than a git checkout. Not sure how much value this has, but it seemed like a good idea.
  • Loading branch information
amalloy committed May 23, 2011
1 parent f7e02b8 commit 2d51c26
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/foreclojure/version.clj
Expand Up @@ -6,11 +6,13 @@
;; fetch this at load time rather than on demand, so that it's accurate even
;; if someone checks out a different revision to poke at without restarting
;; the server (eg to diagnose bugs in a release)
(def sha (:out (sh "git" "rev-parse" "--verify" "HEAD")))
(def sha (not-empty (:out (sh "git" "rev-parse" "--verify" "HEAD"))))

(def-page version []
[:p "SHA: "
[:a {:href (str "http://github.com/dbyrne/4clojure/commit/" sha)} sha]])
(if sha
[:p "SHA: "
[:a {:href (str "http://github.com/dbyrne/4clojure/commit/" sha)} sha]]
[:p "No git repository found"]))

(defroutes version-routes
(GET ["/about/version"] [] (version)))

0 comments on commit 2d51c26

Please sign in to comment.