Skip to content
Browse files

Change :multi-deps to expect a map with set names as keys

  • Loading branch information...
1 parent 01f3ce9 commit 298c1340815b99b1cca2f076363cf6601e511764 @maravillas committed
Showing with 21 additions and 18 deletions.
  1. +4 −4 README.md
  2. +8 −8 src/leiningen/multi.clj
  3. +9 −6 test/leiningen/test/multi.clj
View
8 README.md
@@ -10,10 +10,10 @@ Syntax:
Specify dependency sets in your project.clj:
- :multi-deps [[[org.clojure/clojure "1.1.0"]
- [ring/ring-core "0.2.2"]]
- [[org.clojure/clojure "1.2.0-beta1"]
- [ring/ring-core "0.3.0-beta1"]]]
+ :multi-deps {"1.1" [[org.clojure/clojure "1.1.0"]
+ [ring/ring-core "0.2.2"]]
+ "1.2" [[org.clojure/clojure "1.2.0"]
+ [ring/ring-core "0.3.0-beta1"]]}
Download these dependencies with `lein multi deps` (or by running your tests with `lein multi test`). They will be placed in the folder specified by `:multi-library-path` (default: `multi-lib`).
View
16 src/leiningen/multi.clj
@@ -13,8 +13,8 @@
(str (:root project) "/multi-lib")))
(defn- project-for-set
- [project index deps]
- (merge project {:library-path (str (multi-library-path project) "/set" index)
+ [project name deps]
+ (merge project {:library-path (str (multi-library-path project) "/" name)
:dependencies deps}))
(defn- run-multi-task
@@ -22,10 +22,10 @@
(run-multi-task task-fn project nil))
([task-fn project delimiter-fn]
(doall
- (map-indexed (fn [i v]
- (when delimiter-fn (delimiter-fn i v))
- (task-fn (project-for-set project i v)))
- (:multi-deps project)))))
+ (map (fn [[k v]]
+ (when delimiter-fn (delimiter-fn k v))
+ (task-fn (project-for-set project k v)))
+ (:multi-deps project)))))
(defn- print-base-message
[task project]
@@ -33,8 +33,8 @@
(:dependencies project))))
(defn- print-set-message
- [task n deps]
- (println (str "\nRunning \"lein " task "\" on dependencies set " n ": " deps)))
+ [task name deps]
+ (println (str "\nRunning \"lein " task "\" on dependencies set " name ": " deps)))
;; Handle the deps task individually, as we want to pass the "skip-dev" param
;; to the base call, but pass true for the multi calls.
View
15 test/leiningen/test/multi.clj
@@ -10,7 +10,10 @@
(defn add-clojure-deps
[project & versions]
- (merge project {:multi-deps (vec (map #(vec [['org.clojure/clojure %]]) versions))}))
+ (merge project {:multi-deps
+ (apply hash-map
+ (mapcat (fn [v] [v [['org.clojure/clojure v]]])
+ versions))}))
(defn list-files
[path]
@@ -19,17 +22,17 @@
(deftest test-multi-deps
(delete-file-recursively (file (:root test-project) "lib") true)
(delete-file-recursively (file (:root test-project) "multi-lib-test") true)
- (let [test-project (add-clojure-deps test-project "1.1.0" "1.2.0-beta1")
+ (let [test-project (add-clojure-deps test-project "1.1.0" "1.2.0")
lib-path (str (:root test-project) "/multi-lib-test")]
(multi test-project "deps")
(is (= #{"clojure-1.2.0-RC1.jar"} (list-files (str (:root test-project) "/lib"))))
- (is (= #{"clojure-1.1.0.jar"} (list-files (str lib-path "/set0"))))
- (is (= #{"clojure-1.2.0-beta1.jar"} (list-files (str lib-path "/set1"))))))
+ (is (= #{"clojure-1.1.0.jar"} (list-files (str lib-path "/1.1.0"))))
+ (is (= #{"clojure-1.2.0.jar"} (list-files (str lib-path "/1.2.0"))))))
(deftest test-failing-multi-tests
(delete-file-recursively (file (:root test-project) "multi-lib-test") true)
(println "*** Begin embedded tests - ignore results below ***")
- (let [test-project (add-clojure-deps test-project "1.1.0" "1.2.0-beta1")
+ (let [test-project (add-clojure-deps test-project "1.1.0" "1.2.0")
result (multi test-project "test")]
(println "*** End embedded tests - ignore results above ***")
(is (= result 1))))
@@ -37,7 +40,7 @@
(deftest test-passing-multi-tests
(delete-file-recursively (file (:root test-project) "multi-lib-test") true)
(println "*** Begin embedded tests - ignore results below ***")
- (let [test-project (add-clojure-deps test-project "1.2.0-beta1")
+ (let [test-project (add-clojure-deps test-project "1.2.0")
result (multi test-project "test")]
(println "*** End embedded tests - ignore results above ***")
(is (= result 0))))

0 comments on commit 298c134

Please sign in to comment.
Something went wrong with that request. Please try again.