Permalink
Browse files

Pluralize paths.

  • Loading branch information...
1 parent 0dc1924 commit be61a647f7143a3ba4cd1ea5a334a6392460283c @technomancy committed Feb 23, 2012
Showing with 12 additions and 9 deletions.
  1. +7 −5 src/leiningen/precate.clj
  2. +4 −4 test/leiningen/test/precate.clj
  3. +1 −0 test/p1.clj
View
@@ -79,7 +79,7 @@
(if-let [ecd (:extra-classpath-dirs project)]
(-> (dissoc project :extra-classpath-dirs)
(update-in [:profiles :dev] (fnil into {}) {})
- (update-in [:profiles :dev :resources-path] (fnil into []) ecd))
+ (update-in [:profiles :dev :resource-paths] (fnil into []) ecd))
project))
(defn repositories-format [project]
@@ -88,16 +88,18 @@
(defn dependencies-format [project]
(update-in project [:dependencies] (partial into {})))
-(def vec-paths [:source-path :java-source-path :test-path :resources-path])
+(def vec-paths {:source-path :source-paths, :java-source-path :java-source-paths
+ :test-path :test-paths, :resources-path :resource-paths})
-;; TODO: pluralize keys
(defn- vec-pathize [project key]
(if-let [path (project key)]
- (assoc project key (vector (.replace path (:root project) "")))
+ (assoc (dissoc project key) (vec-paths key)
+ (vec (for [p (conj (project (vec-paths key)) path)]
+ (.replace p (:root project) ""))))
project))
(defn paths-as-vectors [project]
- (reduce vec-pathize project vec-paths))
+ (reduce vec-pathize project (keys vec-paths)))
(defn dissoc-empty [project key]
(if (empty? (project key))
@@ -13,13 +13,13 @@
:dependencies {'ordered "1.1.0" 'org.clojure/clojure "1.3.0"}
:min-lein-version "2.0.0"
:profiles {:dev {:dependencies {'robert/hooke "1.1.3"}
- :resources-path ["junk"]}
+ :resource-paths ["junk"]}
:1.2.1 {:dependencies {'org.clojure/clojure "1.2.1"}}
:1.4.0 {:dependencies {'cheshire "2.2.0"
'org.clojure/clojure "1.4.0-beta1"
'slingshot "0.10.1"}}}
:plugins {'lein-tar "1.0.6"
'lein-swank "1.4.1"}}
- (dissoc p1 :source-path :resources-path :root)))
- (is (= ["src/clj"] (:source-path p1)))
- (is (= ["whatever"] (:resources-path p1)))))
+ (dissoc p1 :source-paths :resource-paths :root)))
+ (is (= ["src/clj"] (:source-paths p1)))
+ (is (= ["stuff" "whatever"] (:resource-paths p1)))))
View
@@ -9,6 +9,7 @@
"1.4.0" [[org.clojure/clojure "1.4.0-beta1"]
[slingshot "0.10.1"]
[cheshire "2.2.0"]]}
+ :resource-paths ["stuff"]
:resources-path "whatever"
:source-path "src/clj"
:extra-classpath-dirs ["junk"])

0 comments on commit be61a64

Please sign in to comment.