Skip to content

Commit

Permalink
version is now based on env variable or pom.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed May 31, 2012
1 parent a5613ee commit 2d26de3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 1 addition & 3 deletions project.clj
@@ -1,6 +1,4 @@
(load-file "src/clj/reply/version.clj")

(defproject reply reply.version/*reply-version*
(defproject reply "0.1.0-SNAPSHOT"
:description "REPL-y: A fitter, happier, more productive REPL for Clojure."
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojars.trptcolin/jline "2.7-alpha5"]
Expand Down
2 changes: 1 addition & 1 deletion src/clj/reply/initialization.clj
Expand Up @@ -91,7 +91,7 @@
"Assumes cd-client will be on the classpath when this is evaluated."
[]
`(do
(println "REPL-y" reply.version/*reply-version*)
(println "REPL-y" (reply.version/get-version))
(println "Clojure" (clojure-version))

(use '[clojure.repl :only ~'[source apropos dir]])
Expand Down
20 changes: 18 additions & 2 deletions src/clj/reply/version.clj
@@ -1,3 +1,19 @@
(ns reply.version)
(ns reply.version
(:import java.util.Properties))

(def ^:dynamic *reply-version* "0.1.0-SNAPSHOT")
(defn load-pom-properties
"this loads a config file from the classpath"
[]
(try
(let [file-reader (.. (Thread/currentThread)
(getContextClassLoader)
(getResourceAsStream "META-INF/maven/reply/reply/pom.properties"))
props (Properties.)]
(.load props file-reader)
(into {} props))
(catch Exception e nil)))

(defn get-version []
(or (System/getenv "reply.version")
(get (load-pom-properties) "version")
"version unknown"))

0 comments on commit 2d26de3

Please sign in to comment.