Skip to content
This repository
Browse code

tidy up project preparation steps

  • Loading branch information...
commit fdb0aec4917d8af115ae43c5ed508f04c98907d0 1 parent 46fe096
Teemu Antti-Poika anttipoi authored

Showing 1 changed file with 18 additions and 5 deletions. Show diff stats Hide diff stats

  1. +18 5 src/leiningen/midje.clj
23 src/leiningen/midje.clj
@@ -113,6 +113,21 @@
113 113 (eval-in-project project form init)
114 114 (eval-in-project project form nil nil init)))
115 115
  116 +(defn- merge-test-profile
  117 + "Leiningen 2 supports profiles in project. Test runs are made with profile :test
  118 + and project settings need to be merged from there."
  119 + [project]
  120 + (if leiningen-two-in-use?
  121 + (project/merge-profiles project [:test])
  122 + project))
  123 +
  124 +(defn- append-classpath
  125 + "Inside eval-in-project leiningen 2 does not have plugin's own code on classpath.
  126 + We need it and must therefore add our own code to project classpath."
  127 + [project]
  128 + (update-in project [:dependencies]
  129 + conj ['lein-midje PLUGIN_VERSION]))
  130 +
116 131 (defn midje
117 132 "Runs both Midje and clojure.test tests.
118 133 There are three ways to use this plugin:
@@ -131,11 +146,9 @@
131 146 when they change.
132 147 NOTE: Requires lazytest dev-dependency."
133 148 [project & lazytest-or-namespaces]
134   - (let [project (if leiningen-two-in-use?
135   - (project/merge-profiles project [:test])
136   - project)
137   - project (update-in project [:dependencies]
138   - conj ['lein-midje PLUGIN_VERSION])
  149 + (let [project (-> project
  150 + merge-test-profile
  151 + append-classpath)
139 152 lazy-test-mode? (= "--lazytest" (first lazytest-or-namespaces))
140 153 paths (collect-paths project)]
141 154 (if lazy-test-mode?

0 comments on commit fdb0aec

Please sign in to comment.
Something went wrong with that request. Please try again.