Skip to content
Browse files

Initial commmit

  • Loading branch information...
0 parents commit a6f5fe9615154fdda14b8d027d852ad9d3e97b19 @maravillas committed Aug 2, 2010
Showing with 68 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +17 −0 README
  3. +7 −0 project.clj
  4. +21 −0 src/leiningen/multi.clj
  5. +18 −0 test/leiningen/test/multi.clj
5 .gitignore
@@ -0,0 +1,5 @@
+pom.xml
+*jar
+lib
+classes
+*~
17 README
@@ -0,0 +1,17 @@
+# lein-multi
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+Copyright (C) 2010 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
7 project.clj
@@ -0,0 +1,7 @@
+(defproject lein-multi "0.1.0-SNAPSHOT"
+ :description "A Leiningen plugin for running tasks against multiple dependency sets."
+ :dev-dependencies [[org.clojure/clojure "1.2.0-RC1"]
+ [org.clojure/clojure-contrib "1.2.0-RC1"]
+ [lein-clojars "0.5.0-SNAPSHOT"]
+ [swank-clojure "1.2.1"]
+ [leiningen "1.1.0"]])
21 src/leiningen/multi.clj
@@ -0,0 +1,21 @@
+(ns leiningen.multi
+ (:use [leiningen.deps :only [deps]]))
+
+;; Hook clean
+;; Put multi deps in /multi-lib
+
+;; http://thinkrelevance.com/blog/2009/08/12/rifle-oriented-programming-with-clojure-2.html
+(defn- indexed
+ [coll]
+ (map vector (iterate inc 0) coll))
+
+(defn- run-deps
+ [project]
+ (doseq [[index deps-set] (indexed (:multi-deps project))]
+ (deps (merge project {:library-path (format "multi-lib/set%d" index)
+ :dependencies deps-set}) true)))
+
+(defn multi
+ [project task & args]
+ (when (= task "deps")
+ (run-deps project)))
18 test/leiningen/test/multi.clj
@@ -0,0 +1,18 @@
+(ns leiningen.test.multi
+ (:use [leiningen.multi] :reload-all)
+ (:use [leiningen.core]
+ [clojure.test]
+ [clojure.contrib.io :only [file]]))
+
+(defproject lein-multi-test "0.1.0"
+ :dependencies [[org.clojure/clojure "1.2.0-RC1"]])
+
+(deftest test-multi-deps
+ (let [project (merge lein-multi-test
+ {:multi-library-path "multi-lib-test"
+ :multi-deps [[['org.clojure/clojure "1.1.0"]]
+ [['org.clojure/clojure "1.2.0-beta1"]]]})]
+ (multi project "deps")
+ (println (file (:root project) "multi-lib-test" "set0" "clojure-1.1.0.jar"))
+ (is (.exists (file (:root project) "multi-lib-test" "set0" "clojure-1.1.0.jar")))
+ (is (.exists (file (:root project) "multi-lib-test" "set1" "clojure-1.2.0-beta1.jar")))))

0 comments on commit a6f5fe9

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