Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's no spec-specific Leiningen profile #153

Open
ideal-knee opened this issue Mar 14, 2016 · 2 comments
Open

There's no spec-specific Leiningen profile #153

ideal-knee opened this issue Mar 14, 2016 · 2 comments

Comments

@ideal-knee
Copy link

The default Leiningen test task merges in a test-specific profile, which allows libraries such as Environ to appropriately use dev or test configurations depending on task.

My proposed patch:

--- a/src/leiningen/spec.clj
+++ b/src/leiningen/spec.clj
@@ -1,5 +1,6 @@
 (ns leiningen.spec
   (:require [leiningen.core.eval :refer [eval-in-project]]
+            [leiningen.core.project :refer [merge-profiles]]
             [leiningen.core.main :as main]))

 (defn make-run-form [project speclj-args]
@@ -36,7 +37,9 @@ documentation, as opposed to this message provided by Leiningen, try this:

 That ought to do the trick."
   [project & args]
-  (let [project (assoc project :eval-in (get project :speclj-eval-in :subprocess))
+  (let [project (-> project
+                    (assoc :eval-in (get project :speclj-eval-in :subprocess))
+                    (merge-profiles [:spec]))
         speclj-args (build-args project args)
         run-form (make-run-form project speclj-args)
         init-form '(require 'speclj.cli)]

This would allow users to define spec-specific profiles. All specs run by lein spec passed with this change (I do not have phantomjs installed to run the ClojureScript specs). I also could not find any specs for the leiningen.spec namespace, so I didn't write any tests.

@ideal-knee
Copy link
Author

A potential README patch:

--- a/README.md
+++ b/README.md
@@ -36,6 +36,16 @@ Include speclj in your `:dev` profile `:dependencies` and`:plugins`. Then change
 :test-paths ["spec"]
 \```

+### `spec` Profile
+
+You can specify a `:spec` profile for testing-specific configuration.  E.g. for [Environ](https://github.com/weavejester/environ):
+
+```
+; - snip
+:profiles {:dev {:env {:database-url "<dev-db-url>"}}
+           :spec {:env {:database-url "<spec-db-url>"}}}
+```
+
 ## Manual installation

 1. Check out the source code: [https://github.com/slagyr/speclj](https://github.com/slagyr/speclj)

(I manually added a \ in that patch to get it to render correcty.)

@ideal-knee
Copy link
Author

If anyone is interested in using this patch, it is available on Clojars: https://clojars.org/org.clojars.ideal-knee/speclj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant