Permalink
Browse files

Merge branch 'master' of github.com:slagyr/speclj

  • Loading branch information...
2 parents bb347d2 + 58af488 commit bed1072668a2b571d64c4c54714811bdf43ec775 @slagyr committed Jul 2, 2012
Showing with 32 additions and 9 deletions.
  1. +1 −0 .gitignore
  2. +5 −1 README.md
  3. +7 −5 project.clj
  4. +19 −3 src/leiningen/spec.clj
View
@@ -5,3 +5,4 @@ out
*.jar
.idea
*.lein-deps-sum
+target
View
@@ -9,7 +9,7 @@ You will need [Leiningen](https://github.com/technomancy/leiningen) version 1.4
Include speclj in your `:dev-dependencies` and change the `:test-path` to `"spec/"`
- :dev-dependencies [[speclj "1.2.0"]]
+ :dev-dependencies [[speclj "2.1.2"]]
:test-path "spec/"
## Manual installation
@@ -105,6 +105,10 @@ The command below will start a process that will watch the source files and run
$ java -cp <...> speclj.main -a
+You can also run the watcher through Leiningen. The benefit of that is that the color of the output is preserved.
+
+ $ lein spec -a
+
## Options
There are several options for the runners. Use the `--help` options to see them all. Or visit [Command Line Options](https://github.com/slagyr/speclj/wiki/Command-Line-Options).
View
@@ -1,16 +1,18 @@
-(require 'speclj.version)
+(load-file "src/speclj/version.clj")
(defproject speclj speclj.version/string
:description "speclj: Pronounced 'speckle', is a Behavior Driven Development framework for Clojure."
:license {:name "The MIT License"
:url "file://LICENSE"
:distribution :repo
:comments "Copyright © 2011 Micah Martin All Rights Reserved."}
- :dependencies [[org.clojure/clojure "1.4.0-alpha3"]
+ :dependencies [[org.clojure/clojure "1.4.0"]
[fresh "1.0.2"]
[mmargs "1.2.0"]]
- :dev-dependencies []
- :test-path "spec/"
- :java-source-path "src/"
+ :eval-in-leiningen true
+ :test-path "spec"
+ :test-paths ["spec"]
+ :java-source-path "src"
+ :java-source-paths ["src"]
:uberjar-exclusions [#"^clojure/.*"]
)
@@ -1,7 +1,6 @@
(ns leiningen.spec
(:use
- [clojure.java.io :only [file]]
- [leiningen.classpath :only [get-classpath-string]])
+ [clojure.java.io :only [file]])
(:import
[java.io BufferedInputStream]))
@@ -27,8 +26,25 @@
(.join error-thread 1000)
(.exitValue process)))
+(defn- compute-classpath-string [project]
+ (clojure.string/join java.io.File/pathSeparatorChar
+ ((or (ns-resolve (create-ns 'leiningen.classpath) 'get-classpath)
+ (ns-resolve (create-ns 'leiningen.core.classpath) 'get-classpath))
+ project)))
+
+(defn- prepare [project]
+ (try
+ (require 'leiningen.core.eval)
+ ((ns-resolve 'leiningen.core.eval 'prep)
+ project)
+ (catch Exception e
+ (require 'leiningen.classpath
+ 'leiningen.compile)
+ ((ns-resolve 'leiningen.compile 'prep) project false))))
+
(defn spec [project & args]
+ (prepare project)
(let [speclj-args (cons "-c" args)
- classpath (get-classpath-string project)
+ classpath (compute-classpath-string project)
jvm-args ["-cp" classpath "-Dspeclj.invocation=lein spec"]]
(java jvm-args "speclj.main" speclj-args (:root project))))

0 comments on commit bed1072

Please sign in to comment.