Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move *interactive?* flag to leiningen.core.

  • Loading branch information...
commit 408b07a761b2e8de613da813b9f0a8887d261ccb 1 parent 1c7a5f0
@technomancy technomancy authored
View
6 README.md
@@ -77,13 +77,13 @@ advantage of this, you should put it on your <tt>$PATH</tt>.
## Configuration
-Place a <tt>project.clj</tt> file in the project root like this:
+The <tt>project.clj</tt> file in the project root should look like this:
(defproject myproject "0.5.0-SNAPSHOT"
:description "A build tool designed to not set your hair on fire."
:url "http://github.com/technomancy/leiningen"
- :dependencies [[org.clojure/clojure "1.1.0"]
- [org.clojure/clojure-contrib "1.1.0"]]
+ :dependencies [[org.clojure/clojure "1.2.1"]
+ [org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[swank-clojure "1.2.1"]])
The <tt>lein new</tt> task generates a project skeleton with an
View
12 src/leiningen/compile.clj
@@ -1,7 +1,7 @@
(ns leiningen.compile
"Compile Clojure source into .class files."
(:use [leiningen.deps :only [deps find-jars]]
- [leiningen.core :only [defdeprecated user-settings]]
+ [leiningen.core :only [defdeprecated user-settings *interactive?*]]
[leiningen.javac :only [javac]]
[leiningen.classpath :only [make-path get-classpath]]
@@ -111,7 +111,14 @@
~(injected-forms)
(set! ~'*warn-on-reflection*
~(:warn-on-reflection project))
- ~form)]
+ (try ~form
+ ;; non-daemon threads will prevent process from exiting;
+ ;; see http://tinyurl.com/2ueqjkl
+ (finally
+ (when-not (or (= "1.5" (System/getProperty
+ "java.specification.version"))
+ ~*interactive?*)
+ (shutdown-agents)))))]
;; work around java's command line handling on windows
;; http://bit.ly/9c6biv This isn't perfect, but works for what's
;; currently being passed; see
@@ -162,7 +169,6 @@
(when (:debug project)
(add-system-property java :clojure.debug true))
(when (.exists (file (:native-path project)))
- ;; TODO: support fn in :native-path?
(add-system-property java "java.library.path" (:native-path project)))
(.setClasspath java (apply make-path (get-classpath project)))
(.setFailonerror java true)
View
2  src/leiningen/core.clj
@@ -9,6 +9,8 @@
(:import (java.io File)
(org.apache.maven.artifact.versioning DefaultArtifactVersion)))
+(def *interactive?* false)
+
(defmacro defdeprecated [old new]
`(let [new# ~(str (.getName (:ns (meta (resolve new)))) "/" (name new))
warn# (delay (println "Warning:" '~old "is deprecated; use" new#))]
View
1  src/leiningen/deps.clj
@@ -68,6 +68,7 @@
(lancet/copy {:todir destination :flatten (if flatten? "on" "off")}
fileset))
+;; TODO: remove in 2.0; with local-repo-classpath it's unnecessary
(defmethod copy-dependencies :symlink [k destination flatten? fileset]
(let [files (.getIncludedFiles
(.getDirectoryScanner fileset lancet/ant-project))
View
4 src/leiningen/interactive.clj
@@ -1,7 +1,7 @@
(ns leiningen.interactive
"Enter interactive task shell."
(:require [clojure.string :as string])
- (:use [leiningen.core :only [apply-task exit]]
+ (:use [leiningen.core :only [apply-task exit *interactive*]]
[leiningen.test :only [*exit-after-tests*]]
[leiningen.repl :only [repl-server repl-socket-on
copy-out-loop poll-repl-connection]]
@@ -11,8 +11,6 @@
(def prompt "lein> ")
-(def *interactive* false)
-
(defn not-found [& _]
(println "That's not a task. Use help to list all tasks."))
View
7 src/leiningen/test.clj
@@ -2,6 +2,7 @@
"Run the project's tests."
(:refer-clojure :exclude [test])
(:use [clojure.java.io :only [file]]
+ [leiningen.core :only [*interactive?*]]
[leiningen.util.ns :only [namespaces-in-dir]]
[leiningen.compile :only [eval-in-project]])
(:import (java.io File)))
@@ -38,16 +39,12 @@ each namespace and print an overall summary."
summary# (binding [clojure.test/*test-out* *out*]
(apply ~'clojure.test/run-tests '~namespaces))]
(spit ".lein-failures" (pr-str @failures#))
- (when (and (not= "1.5" (System/getProperty
- "java.specification.version"))
- ~*exit-after-tests*)
- (shutdown-agents))
;; Stupid ant won't let us return anything, so write results to disk
(with-open [w# (-> (java.io.File. ~result-file)
(java.io.FileOutputStream.)
(java.io.OutputStreamWriter.))]
(.write w# (pr-str summary#)))
- (when ~*exit-after-tests*
+ (when-not ~*interactive?*
(System/exit 0))))))
(defn- read-args [args project]
View
3  todo.org
@@ -38,11 +38,10 @@ See also https://github.com/technomancy/leiningen/issues
- new push task based on clj-ssh
lein-clojars task doesn't support DSA keys
* For 1.6
- - [ ] move exit-after-tests check to eval-in-project (discuss on list?)
- - [ ] upgrade new task
- [ ] suppress useless ant output in classpath calculation for :local-repo-classpath
- [ ] Trampoline functionality
http://groups.google.com/group/leiningen/browse_thread/thread/a07a7f10edb77c9b
+ - [x] move exit-after-tests check to eval-in-project (discuss on list?)
- [x] don't freak out when attempting to download non-existent indices
- [x] improve error message for unconfigured deploy
- [x] make search work outside project
Please sign in to comment.
Something went wrong with that request. Please try again.