Permalink
Browse files

fix #6

  • Loading branch information...
1 parent df736fb commit c99cf74d20ef19f9e7c17cd0486db084d97eaa6d @kumarshantanu committed Aug 29, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/leiningen/sub.clj
View
8 src/leiningen/sub.clj
@@ -2,24 +2,28 @@
(:require [leiningen.core.main :as main]
[leiningen.core.project :as project]))
+
(defn apply-task-to-subproject
[sub-proj-dir task-name args]
(println "Reading project from" sub-proj-dir)
(let [sub-project (project/read (str sub-proj-dir "/project.clj"))]
(main/apply-task task-name sub-project args)))
+
(defn run-subproject [task-name args total-result sub]
(if (zero? total-result)
(let [result (apply-task-to-subproject sub task-name args)]
(if (and (integer? result) (pos? result)) result 0))
total-result))
+
(defn sub
"Run task for all subprojects"
[project task-name & args]
(if-let [subprojects (:sub project)]
- (reduce (partial run-subproject task-name args)
- 0 (:sub project))
+ (->> subprojects
+ (reduce (partial run-subproject task-name args) 0)
+ main/exit)
(println "No subprojects defined. Define with :sub key in project.clj, e.g.
:sub [\"modules/dep1\" \"modules/proj-common\"]

0 comments on commit c99cf74

Please sign in to comment.