Update bootstrapping instructions, remove old lein.util.* references.

This commit is contained in:
Phil Hagelberg 2012-01-12 18:04:57 -08:00
parent 3ae4b06c2e
commit 1fee69f7b3
10 changed files with 37 additions and 50 deletions

View file

@ -1,6 +1,7 @@
# Leiningen # Leiningen
<img src="https://github.com/downloads/technomancy/leiningen/leiningen-banner.png" alt="Leiningen logo" title="The man himself" align="right" /> <img src="https://github.com/downloads/technomancy/leiningen/leiningen-banner.png"
alt="Leiningen logo" title="The man himself" align="right" />
> "Leiningen!" he shouted. "You're insane! They're not creatures you can > "Leiningen!" he shouted. "You're insane! They're not creatures you can
> fight--they're an elemental--an 'act of God!' Ten miles long, two > fight--they're an elemental--an 'act of God!' Ten miles long, two
@ -28,9 +29,9 @@ can just run `lein self-install`, otherwise get the standalone jar from the
If you have [Cygwin](http://www.cygwin.com/) you should be able to use If you have [Cygwin](http://www.cygwin.com/) you should be able to use
the shell script above rather than the batch file. the shell script above rather than the batch file.
The master branch is currently undergoing massive changes for The `master` branch is currently undergoing massive changes for
Leiningen 2.0; you should not expect it to work. If you want to build Leiningen 2.0; you should not expect it to work. If you want to build
from source for everyday use, use the 1.x branch. from source for everyday use, use the `1.x` branch.
## Usage ## Usage
@ -59,7 +60,7 @@ You can also chain tasks together in a single command by using commas:
$ lein clean, test foo.test-core, jar $ lein clean, test foo.test-core, jar
Most tasks need to be run from somewhere inside a project directory to Most tasks need to be run from somewhere inside a project directory to
work, but some (`new`, `help`, `version`, `plugin`, and the work, but some (`new`, `help`, `version`, and the
two-argument version of `install`) may run from anywhere. two-argument version of `install`) may run from anywhere.
The install task places shell scripts in the `~/.lein/bin` The install task places shell scripts in the `~/.lein/bin`
@ -99,7 +100,7 @@ You can change the configuration of your project by applying various
profiles. Each profile is defined as a map which gets merged into your profiles. Each profile is defined as a map which gets merged into your
project map. project map.
Profiles are read from 4 different locations: (in order of precedence) Profiles are read from 3 different locations: (in order of precedence)
* the `:profiles` entry in the project map * the `:profiles` entry in the project map
* the `~/.lein/profiles.clj` file * the `~/.lein/profiles.clj` file
@ -109,10 +110,11 @@ Each of these should be a map of profile names to profile maps.
Note that profiles have special logic when they are merged into your Note that profiles have special logic when they are merged into your
project map: maps get merged recursively, but sets are `union`ed and project map: maps get merged recursively, but sets are `union`ed and
collections are `concat`enated. Other values are simply replaced. other collections are `concat`enated. Other values are simply
Profiles take precedence in the order they are specified. replaced. Profiles take precedence in the order they are specified.
To activate a profile, use the `with-profile` higher-order task: To activate a profile for a given run, use the `with-profile`
higher-order task:
$ lein with-profile qa test :database $ lein with-profile qa test :database
@ -122,14 +124,16 @@ active by default.
### Leiningen Plugins ### Leiningen Plugins
Leiningen supports plugins which contain both new tasks and hooks that Leiningen supports plugins which may contain both new tasks and hooks
modify existing tasks. See that modify behaivour of existing tasks. See
[the plugins wiki page](https://github.com/technomancy/leiningen/wiki/Plugins) [the plugins wiki page](https://github.com/technomancy/leiningen/wiki/Plugins)
for a full list. If a plugin is needed for successful test or build for a full list. If a plugin is needed for successful test or build
runs, (such as `lein-tar`) then it should be added to `:plugins` in runs, (such as `lein-tar`) then it should be added to `:plugins` in
project.clj, but if it's for your own convenience (such as project.clj, but if it's for your own convenience (such as
swank-clojure) then it should be added to the `:plugins` list in the swank-clojure) then it should be added to the `:plugins` list in the
`:user` profile from `~/.lein/profiles.clj`. `:user` profile from `~/.lein/profiles.clj`. The
[plugin guide](https://github.com/technomancy/leiningen/blob/stable/doc/PLUGINS.md)
explains how to write plugins.
## FAQ ## FAQ
@ -144,23 +148,11 @@ swank-clojure) then it should be added to the `:plugins` list in the
**Q:** How should I pick my version numbers? **Q:** How should I pick my version numbers?
**A:** Use [semantic versioning](http://semver.org). **A:** Use [semantic versioning](http://semver.org).
**Q:** It says a required artifact is missing for "super-pom". What's that?
**A:** The Maven API that Leiningen uses refers to your project as
"super-pom". It's just a quirk of the API. It probably means there
is a typo in your :dependency declaration in project.clj.
**Q:** What if my project depends on jars that aren't in any repository? **Q:** What if my project depends on jars that aren't in any repository?
**A:** The [deploy guide](https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md) **A:** The [deploy guide](https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md)
explains how to set up a private repository. If you are not sharing explains how to set up a private repository. If you are not sharing
them with a team you could also just [install locally](https://github.com/kumarshantanu/lein-localrepo). them with a team you could also just [install locally](https://github.com/kumarshantanu/lein-localrepo).
**Q:** How do I write my own tasks?
**A:** You can use `lein new plugin lein-myplugin` to create a new
[plugin project](https://github.com/technomancy/leiningen/blob/stable/doc/PLUGINS.md).
You can also include one-off tasks in your src/leiningen/ directory,
but it's actually fairly rare to have a task that's truly unique to
your project.
**Q:** I want to hack two projects in parallel, but it's annoying to switch between them. **Q:** I want to hack two projects in parallel, but it's annoying to switch between them.
**A:** If you create a directory called `checkouts` in your project **A:** If you create a directory called `checkouts` in your project
root and symlink some other project roots into it, Leiningen will root and symlink some other project roots into it, Leiningen will
@ -248,19 +240,13 @@ mailing list and mailing a SASE.
## Building ## Building
You don't need to "build" Leiningen per se, but when you're using a You don't need to "build" Leiningen per se, but when you're using a
checkout you will need to get its dependencies in place. In most cases checkout you will need to get its dependencies in place.
a `lein self-install` will usually get you what you
need. However, this will occasionally fail for very new SNAPSHOT
versions since the standalone jar will not have been uploaded yet.
You can also use Maven, just for variety's sake: Using Leiningen 1.x, run `lein deps` in the `leiningen-core`
subproject directory. Once you do that in most cases a `bin/lein
$ mvn dependency:copy-dependencies self-install` will usually get you what you need. However, this will
$ mv target/dependency lib occasionally fail for very new SNAPSHOT versions since the standalone
jar will not have been uploaded yet.
Symlink `bin/lein` from your checkout into a location on the $PATH. The
script can figure out when it's being called from inside a checkout
and use the checkout rather than the self-install uberjar if necessary.
## License ## License

View file

@ -1,7 +1,8 @@
(ns leiningen.javac (ns leiningen.javac
"Compile Java source files." "Compile Java source files."
(:use [leiningen.classpath :only [get-classpath-string]] (:use [leiningen.classpath :only [get-classpath-string]]
[leiningen.util.paths :only [normalize-path]]) ;; [leiningen.util.paths :only [normalize-path]]
)
(:require [lancet.core :as lancet]) (:require [lancet.core :as lancet])
(:import (java.io File))) (:import (java.io File)))
@ -19,7 +20,7 @@
(merge *default-javac-options* (merge *default-javac-options*
(:javac-options project) (:javac-options project)
{:destdir (:compile-path project) {:destdir (:compile-path project)
:srcdir (normalize-path (:root project) path) ;; :srcdir (normalize-path (:root project) path)
:classpath (get-classpath-string project)} :classpath (get-classpath-string project)}
(apply hash-map options))) (apply hash-map options)))

View file

@ -5,9 +5,9 @@
[clojure.java.shell :only [with-sh-dir]] [clojure.java.shell :only [with-sh-dir]]
[leiningen.core.eval :only [eval-in-project]] [leiningen.core.eval :only [eval-in-project]]
[leiningen.compile] [leiningen.compile]
[leiningen.test.helper :only [sample-project sample-failing-project [leiningen.test.helper :only [sample-project delete-file-recursively
tricky-name-project]] sample-failing-project
[leiningen.util.file :only [delete-file-recursively]]) tricky-name-project]])
(:require [leiningen.core.eval :as eval])) (:require [leiningen.core.eval :as eval]))
(use-fixtures :each (fn [f] (use-fixtures :each (fn [f]

View file

@ -3,8 +3,8 @@
[clojure.java.io :only [file]] [clojure.java.io :only [file]]
[leiningen.deploy] [leiningen.deploy]
[leiningen.core :only [read-project defproject]] [leiningen.core :only [read-project defproject]]
[leiningen.util.file :only [delete-file-recursively tmp-dir]] [leiningen.test.helper :only [delete-file-recursively
[leiningen.test.helper :only [sample-project]])) tmp-dir sample-project]]))
(defn- repo-path (defn- repo-path
[relative-repo-path] [relative-repo-path]

View file

@ -5,6 +5,8 @@
;; TODO: fix ;; TODO: fix
(def local-repo (io/file (System/getProperty "user.home") ".m2" "repository")) (def local-repo (io/file (System/getProperty "user.home") ".m2" "repository"))
(def tmp-dir (System/getProperty "java.io.tmpdir"))
(defn m2-dir [n v] (defn m2-dir [n v]
(io/file local-repo (io/file local-repo
(if (string? n) n (or (namespace n) (name n))) (name n) v)) (if (string? n) n (or (namespace n) (name n))) (name n) v))

View file

@ -1,7 +1,7 @@
(ns leiningen.test.install (ns leiningen.test.install
(:require [leiningen.core.user :as user]) (:require [leiningen.core.user :as user])
(:use [clojure.test] (:use [clojure.test]
[leiningen.install] [leiningen.install :exclude [tmp-dir]]
[leiningen.test.helper] [leiningen.test.helper]
[clojure.java.io :only [file]])) [clojure.java.io :only [file]]))

View file

@ -3,8 +3,8 @@
[clojure.java.io :only [file]] [clojure.java.io :only [file]]
[leiningen.javac :only [javac]] [leiningen.javac :only [javac]]
[leiningen.core :only [read-project defproject]] [leiningen.core :only [read-project defproject]]
[leiningen.util.file :only [delete-file-recursively]] [leiningen.test.helper :only [delete-file-recursively
#_[leiningen.test.helper :only [dev-deps-project]])) #_dev-deps-project]]))
(deftest test-javac (deftest test-javac
#_(delete-file-recursively (:compile-path dev-deps-project) true) #_(delete-file-recursively (:compile-path dev-deps-project) true)

View file

@ -2,7 +2,7 @@
(:require [leiningen.new]) (:require [leiningen.new])
(:use [clojure.test] (:use [clojure.test]
[clojure.java.io :only [file]] [clojure.java.io :only [file]]
[leiningen.util.file :only [delete-file-recursively]])) [leiningen.test.helper :only [delete-file-recursively]]))
(deftest test-new (deftest test-new
(leiningen.new/new nil "test-new-proj") (leiningen.new/new nil "test-new-proj")

View file

@ -4,8 +4,7 @@
[clojure.java.io :only [delete-file]] [clojure.java.io :only [delete-file]]
;; [leiningen.javac :only [javac]] ;; [leiningen.javac :only [javac]]
[leiningen.run] [leiningen.run]
[leiningen.util.file :only [tmp-dir]] [leiningen.test.helper :only [tmp-dir tricky-name-project]]))
[leiningen.test.helper :only [tricky-name-project]]))
(def out-file (format "%s/lein-test" tmp-dir)) (def out-file (format "%s/lein-test" tmp-dir))

View file

@ -2,8 +2,7 @@
(:refer-clojure :exclude [test]) (:refer-clojure :exclude [test])
(:use [clojure.test] (:use [clojure.test]
[leiningen.test] [leiningen.test]
[leiningen.util.file :only [tmp-dir]] [leiningen.test.helper :only [tmp-dir sample-no-aot-project]]))
[leiningen.test.helper :only [sample-no-aot-project]]))
(use-fixtures :each (use-fixtures :each
(fn [f] (fn [f]