Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: df736fba05
...
compare: 797a9ebd4f
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 9 additions and 5 deletions.
  1. +2 −2 README.md
  2. +1 −1  project.clj
  3. +6 −2 src/leiningen/sub.clj
View
4 README.md
@@ -9,11 +9,11 @@ Leiningen plugin to execute tasks on sub-projects
Either install as a plugin in `~/.lein/profiles.clj`:
- {:user {:plugins [[lein-sub "0.2.0"]]}}
+ {:user {:plugins [[lein-sub "0.2.1"]]}}
Or, specify as a plugin in `project.clj`:
- :plugins [[lein-sub "0.2.0"]]
+ :plugins [[lein-sub "0.2.1"]]
### Leiningen 1.x users
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject lein-sub "0.2.0"
+(defproject lein-sub "0.2.1"
:description "Leiningen Subprojects plugin"
:url "https://github.com/kumarshantanu/lein-sub"
:eval-in-leiningen true)
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\"]

No commit comments for this range

Something went wrong with that request. Please try again.