forked from technomancy/leiningen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo.clj
More file actions
25 lines (20 loc) · 771 Bytes
/
Copy pathdo.clj
File metadata and controls
25 lines (20 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(ns leiningen.do
(:refer-clojure :exclude [do])
(:require [leiningen.core.main :as main]))
(defn- conj-to-last [coll x]
(update-in coll [(dec (count coll))] conj x))
(defn ^:internal group-args
([args] (reduce group-args [[]] args))
([groups arg]
(if (.endsWith arg ",")
(-> groups
(conj-to-last (subs arg 0 (dec (count arg))))
(conj []))
(conj-to-last groups arg))))
(defn ^:no-project-needed ^:higher-order do
"Higher-order task to perform other tasks in succession.
Each comma-separated group should be a task name followed by optional arguments.
USAGE: lein do test, compile :all, deploy private-repo"
[project & args]
(doseq [arg-group (group-args args)]
(main/resolve-and-apply project arg-group)))