separate combine-profile out into its own function for dsantiago

This commit is contained in:
Justin Balthrop 2012-07-18 16:25:31 -07:00
parent cadfe5c92c
commit c36274b52e

View file

@ -181,13 +181,15 @@
:else (doto latter (println "has a type mismatch merging profiles."))))
(defn- combine-profile [project profile]
(vary-meta (merge-with profile-key-merge project profile)
update-in [:included-profiles] conj profile))
(defn- combine-profiles [project profiles]
;; We reverse because we want profile values to override the project, so we
;; need "last wins" in the reduce, but we want the first profile specified by
;; the user to take precedence.
(reduce (fn [project profile]
(vary-meta (merge-with profile-key-merge project profile)
update-in [:included-profiles] conj profile))
(reduce combine-profile
project
(reverse profiles)))