Added support for replacing/displacing profile values instead of merging.
This commit is contained in:
parent
326df9578a
commit
7f58cbcee5
2 changed files with 18 additions and 2 deletions
8
leiningen-core/src/leiningen/core/project.clj
Normal file → Executable file
8
leiningen-core/src/leiningen/core/project.clj
Normal file → Executable file
|
@ -90,7 +90,13 @@
|
|||
(defn- profile-key-merge
|
||||
"Merge profile values into the project map based on their type."
|
||||
[key result latter]
|
||||
(cond (= :dependencies key)
|
||||
(cond (-> result meta :displace)
|
||||
latter
|
||||
|
||||
(-> latter meta :replace)
|
||||
latter
|
||||
|
||||
(= :dependencies key)
|
||||
(merge-dependencies result latter)
|
||||
|
||||
(= :repositories key)
|
||||
|
|
12
leiningen-core/test/leiningen/core/test/project.clj
Normal file → Executable file
12
leiningen-core/test/leiningen/core/test/project.clj
Normal file → Executable file
|
@ -59,4 +59,14 @@
|
|||
(-> {:resources-path ["resources"]
|
||||
:profiles {:blue {:resources-path ["blue-resources"]}}}
|
||||
(merge-profiles [:qa :tes :blue])
|
||||
:resources-path)))))
|
||||
:resources-path)))
|
||||
(is (= ["/etc/myapp" "test/hi" "blue-resources"]
|
||||
(-> {:resources-path ^:displace ["resources"]
|
||||
:profiles {:blue {:resources-path ["blue-resources"]}}}
|
||||
(merge-profiles [:qa :tes :blue])
|
||||
:resources-path)))
|
||||
(is (= ["replaced"]
|
||||
(-> {:resources-path ["resources"]
|
||||
:profiles {:blue {:resources-path ^:replace ["replaced"]}}}
|
||||
(merge-profiles [:blue :qa :tes ])
|
||||
:resources-path)))))
|
||||
|
|
Loading…
Reference in a new issue