Skip to content

Commit

Permalink
Factor out default-project
Browse files Browse the repository at this point in the history
Pulls the default project used when not in a directory into a separate
function, so it can be used in tests.
  • Loading branch information
hugoduncan committed Sep 16, 2014
1 parent dbf375f commit d684019
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions leiningen-core/src/leiningen/core/main.clj
Expand Up @@ -360,18 +360,23 @@ Get the latest version of Leiningen at http://leiningen.org or by executing

(def ^:dynamic *cwd* (System/getProperty "user.dir"))

(defn default-project
"Return the default project used when not in a project directory."
[]
(-> (project/make {:eval-in :leiningen :prep-tasks []
:source-paths ^:replace []
:resource-paths ^:replace []
:test-paths ^:replace []})
(project/init-project)))

(defn -main
"Command-line entry point."
[& raw-args]
(try
(user/init)
(let [project (if (.exists (io/file *cwd* "project.clj"))
(project/read (str (io/file *cwd* "project.clj")))
(-> (project/make {:eval-in :leiningen :prep-tasks []
:source-paths ^:replace []
:resource-paths ^:replace []
:test-paths ^:replace []})
(project/init-project)))]
(default-project))]
(when (:min-lein-version project) (verify-min-version project))
(configure-http)
(resolve-and-apply project raw-args))
Expand Down

0 comments on commit d684019

Please sign in to comment.