Permalink
Browse files

Minor cleanup of :min-lein-version functions.

  • Loading branch information...
1 parent e507671 commit a4667096be37058905460abc72d9e5a3a96332bb @technomancy committed Aug 24, 2010
Showing with 11 additions and 10 deletions.
  1. +2 −0 sample.project.clj
  2. +8 −9 src/leiningen/core.clj
  3. +1 −1 todo.org
View
@@ -39,6 +39,8 @@
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]]
+ ;; Warns users of earlier versions of Leiningen.
+ :min-lein-version "1.3.0"
;; Before fetching dependencies, the contents of the lib/ directory
;; will get deleted unless this is set to true.
:disable-implicit-clean false
View
@@ -178,20 +178,19 @@
(append-to-group groups arg))))
(defn version-greater-eq?
- "Returns true if 'v1 is greater than or equal to 'v2, where v# are version strings. Takes major, minor and incremental versions into account."
+ "Check if v1 is greater than or equal to v2, where args are version strings.
+Takes major, minor and incremental versions into account."
[v1 v2]
(let [v1 (map #(Integer. %) (re-seq #"\d" (first (split v1 #"-" 2))))
v2 (map #(Integer. %) (re-seq #"\d" (first (split v2 #"-" 2))))]
- (or (and (every? true? (map (fn [a b]
- (>= a b)) v1 v2))
+ (or (and (every? true? (map >= v1 v2))
(>= (count v1) (count v2)))
- (every? true? (map (fn [a b]
- (> a b)) v1 v2)))))
+ (every? true? (map > v1 v2)))))
(defn verify-min-version
[project]
- (if-not (version-greater-eq? (System/getenv "LEIN_VERSION")
- (:min-lein-version project))
+ (when-not (version-greater-eq? (System/getenv "LEIN_VERSION")
+ (:min-lein-version project))
(do (println (str "\n*** Warning: This project requires Leiningen version "
(:min-lein-version project)
" ***"
@@ -206,8 +205,8 @@
(let [task-name (or (@aliases task-name) task-name "help")
project (if (.exists (File. "project.clj")) (read-project))
compile-path (:compile-path project)]
- (if-not (nil? (:min-lein-version project))
- (verify-min-version project))
+ (when (:min-lein-version project)
+ (verify-min-version project))
(user-init project)
(when compile-path (.mkdirs (File. compile-path)))
(binding [*compile-path* compile-path]
View
@@ -14,8 +14,8 @@ Leiningen TODOs
** TODO test classification using metadata; run a subset of tests
** TODO a list of dirs to include in the jar when building
** TODO re-compile all deps with current clojure version
-** TODO specify min. lein version in project.clj
* For 1.3.0
+** DONE specify min. lein version in project.clj
** DONE :omit-source
** DONE lein install $PROJECT (works outside project root)
Possibly take some of this from cljr?

0 comments on commit a466709

Please sign in to comment.