Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch :repositories to vector format to preserve ordering.

  • Loading branch information...
commit b5a193d3313bd0b33073712ab78fc80a5d58ad56 1 parent 72969e7
@technomancy authored
View
20 doc/DEPLOY.md
@@ -11,7 +11,7 @@ There may be times when you want to make a library available to your
team without making it public. This is best done by setting up a
private repository. The simplest kind of private repository is a web
server pointed at a directory full of static files. You can use a
-`file:///` URL in your `:repositories` key to deploy that way if the
+`file:///` URL in your `:repositories` to deploy that way if the
directory is local to the machine on which Leiningen is running.
[Amazon S3](http://aws.amazon.com/s3/) buckets are another simple
choice; you can deploy to S3 buckets using
@@ -29,8 +29,8 @@ listing in project.clj. Archiva and Nexus offer separate repositories
for snapshots and releases, so you'll want two entries for them:
```clj
-:repositories {"snapshots" "http://blueant.com/archiva/snapshots"
- "releases" "http://blueant.com/archiva/internal"}
+:repositories [["snapshots" "http://blueant.com/archiva/snapshots"]
+ ["releases" "http://blueant.com/archiva/internal"]]
```
If you are are deploying to a repository that is _only_ used for deployment
@@ -41,7 +41,7 @@ Deployment-only repositories useful across a number of locally developed
projects may also be specified in the `:user` profile in `~/.lein/profiles.clj`:
```clj
-{:user {:deploy-repositories {"internal" "http://blueant.com/archiva/internal"}}}
+{:user {:deploy-repositories [["internal" "http://blueant.com/archiva/internal"]]}}
```
## Authentication
@@ -59,8 +59,8 @@ Leiningen will decrypt `~/.lein/credentials.clj.gpg` and use that to
find the proper credentials for the given repository.
```clj
-:repositories {"releases" {:url "http://blueant.com/archiva/internal"
- :username "milgrim" :password :gpg}}
+:repositories [["releases" {:url "http://blueant.com/archiva/internal"
+ :username "milgrim" :password :gpg}]]
```
First write your credentials map to `~/.lein/credentials.clj` like so:
@@ -151,10 +151,10 @@ plain-text `credentials.clj` using GPG.
3. Add the OSS deployment repository endpoints to your project.clj, e.g.:
```clojure
-:deploy-repositories {"releases" {:url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
- :creds :gpg}
- "snapshots" {:url "https://oss.sonatype.org/content/repositories/snapshots/"
- :creds :gpg}}
+:deploy-repositories [["releases" {:url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+ :creds :gpg}
+ "snapshots" {:url "https://oss.sonatype.org/content/repositories/snapshots/"
+ :creds :gpg}]]
```
4. Conform to OSS' requirements for uploaded artifacts' `pom.xml` files;
View
1  leiningen-core/project.clj
@@ -7,7 +7,6 @@
[bultitude "0.1.7"]
[classlojure "0.6.6"]
[robert/hooke "1.1.2"]
- [ordered "1.3.1"]
[com.cemerick/pomegranate "0.0.13"
:exclusions [org.slf4j/slf4j-api]]]
;; This is only used when releasing Leiningen. Can't put it in a
View
12 leiningen-core/src/leiningen/core/project.clj
@@ -4,7 +4,6 @@
(:require [clojure.walk :as walk]
[clojure.java.io :as io]
[clojure.set :as set]
- [ordered.map :as ordered]
[cemerick.pomegranate :as pomegranate]
[cemerick.pomegranate.aether :as aether]
[leiningen.core.utils :as utils]
@@ -40,12 +39,11 @@
:compile-path "target/classes"
:target-path "target"
:prep-tasks ["javac" "compile"]
- :repositories (ordered/ordered-map
- "central" {:url "http://repo1.maven.org/maven2"}
+ :repositories [["central" {:url "http://repo1.maven.org/maven2"}]
;; TODO: point to releases-only before 2.0 is out
- "clojars" {:url "https://clojars.org/repo/"})
- :deploy-repositories {"clojars" {:url "https://clojars.org/repo/"
- :password :gpg}}
+ ["clojars" {:url "https://clojars.org/repo/"}]]
+ :deploy-repositories [["clojars" {:url "https://clojars.org/repo/"
+ :password :gpg}]]
:jar-exclusions [#"^\."]
:jvm-opts ["-XX:+TieredCompilation"]
:certificates ["clojars.pem"]
@@ -73,7 +71,7 @@
(assoc project :repositories
(into (if-not omit-default-repositories
(:repositories defaults)
- (ordered/ordered-map))
+ [])
(for [[id repo] repositories
;; user-level :repos entries may contain just credentials
:when (or (string? repo) (:url repo))]
View
4 leiningen-core/test/leiningen/core/test/project.clj
@@ -35,8 +35,8 @@
[stencil "0.2.0"]],
:twelve 12 ; testing unquote
- :repositories {"central" {:url "http://repo1.maven.org/maven2"}
- "clojars" {:url "https://clojars.org/repo/"}}})
+ :repositories [["central "{:url "http://repo1.maven.org/maven2"}]
+ ["clojars" {:url "https://clojars.org/repo/"}]]})
(deftest test-read-project
(let [actual (read (.getFile (io/resource "p1.clj")))]
View
44 sample.project.clj
@@ -158,36 +158,34 @@
:omit-default-repositories true
;; These repositories will be searched for :dependencies and
;; :plugins and will also be available to deploy to.
- :repositories {"java.net" "http://download.java.net/maven/2"
- "sonatype"
- {:url "http://oss.sonatype.org/content/repositories/releases"
- ;; If a repository contains releases only; setting :snapshots
- ;; to false will speed up dependency checking.
- :snapshots false
- ;; You can also set the policies for how to handle :checksum
- ;; failures to :fail, :warn, or :ignore. In :releases, :daily,
- ;; :always, and :never are supported.
- :releases {:checksum :fail :update :always}
- ;; You can set :checksum and :update here for them
- ;; to apply to both :releases and :snapshots:
- :update :always, :checksum :fail}
+ :repositories [["java.net" "http://download.java.net/maven/2"]
+ ["sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"
+ ;; If a repository contains releases only setting
+ ;; :snapshots to false will speed up dependencies.
+ :snapshots false
+ ;; You can also set the policies for how to handle
+ ;; :checksum failures to :fail, :warn, or :ignore.
+ :checksum :fail
+ ;; How often should this repository be checked
+ ;; for updates? (:daily, :always, or :never)
+ :update :always
+ ;; You can also apply them to releases only:
+ :releases {:checksum :fail :update :always}}]
;; Repositories named "snapshots" and "releases" automatically
;; have their :snapshots and :releases disabled as appropriate.
;; Credentials for repositories should *not* be stored
- ;; in project.clj but in ~/.lein/profiles.clj instead:
- ;; {:auth {:repository-auth {#"http://blueant.com/archiva/"
- ;; {:username "milgrim"
- ;; :password "locative.1"}}}}
+ ;; in project.clj but in ~/.lein/credentials.clj.gpg instead,
+ ;; see `lein help deploying` under "Authentication".
"snapshots" "http://blueant.com/archiva/snapshots"
"releases" {:url "http://blueant.com/archiva/internal"
;; Using :env as a value here will cause an
;; enironment variable to be used based on
;; the key; in this case LEIN_PASSWORD.
- :username "milgrim" :password :env}}
+ :username "milgrim" :password :env}]
;; These repositories will be included with :repositories when loading plugins.
;; This would normally be set in a profile for non-public repositories.
;; All the options are the same as in the :repositories map.
- :plugin-repositories {"internal-plugin-repo" "http://example.org/repo"}
+ :plugin-repositories [["internal-plugin-repo" "http://example.org/repo"]]
;; You can set :update and :checksum policies here to have them
;; apply for all :repositories. Usually you will not set :update
;; directly but apply the "update" profile instead.
@@ -196,8 +194,8 @@
;; the deploy task will give preference to repositories specified in
;; :deploy-repositories, and repos listed there will not be used for
;; dependency resolution.
- :deploy-repositories {"releases" "http://blueant.com/archiva/internal/releases"
- "snapshots" "http://blueant.com/archiva/internal/snapshots"}
+ :deploy-repositories [["releases" "http://blueant.com/archiva/internal/releases"]
+ ["snapshots" "http://blueant.com/archiva/internal/snapshots"]]
;; Fetch dependencies from mirrors. Mirrors override repositories when the key
;; in the :mirrors map matches either the name or URL of a specified
;; repository. All settings supported in :repositories may be set here too.
@@ -209,8 +207,8 @@
;; Prevent Leiningen from checking the network for dependencies.
;; This wouldn't normally be set in project.clj; it would come from a profile.
:offline? true
- ;; Override the location of the local maven repository.
- :local-repo "/home/dude/.lein/repo"
+ ;; Override location of the local maven repository. Relative to project root.
+ :local-repo "local-m2"
;; If you'd rather use a different directory structure, you can set these.
;; Paths that contain "inputs" are vectors, "outputs" are strings.
:source-paths ["src" "src/main/clojure"]
View
24 src/leiningen/deploy.clj
@@ -30,17 +30,13 @@
(into-array ["Password: "]))]
[id (assoc settings :username username :password password)]))))
-(defn repo-for [project repository-name]
- ;; can't use merge here due to bug in ordered maps:
- ;; https://github.com/flatland/ordered/issues/4
- (let [repo-opts (or (get (:deploy-repositories project) repository-name)
- (get (:repositories project) repository-name))
- repo (cond (not repo-opts) ["inline" {:url repository-name}]
- (string? repo-opts) [repository-name {:url repo-opts}]
- :else [repository-name repo-opts])
- repo (classpath/add-repo-auth repo)
- repo (add-auth-interactively repo)]
- repo))
+(defn repo-for [project name]
+ (let [settings (get (merge {name {:url name}}
+ (:repositories project)
+ (:deploy-repositories project)) name)]
+ (-> [name settings]
+ (classpath/add-repo-auth)
+ (add-auth-interactively))))
(defn sign [file]
(let [exit (binding [*out* (java.io.StringWriter.)]
@@ -73,9 +69,9 @@
The target repository will be looked up in :repositories in project.clj:
- :repositories {\"snapshots\" \"https://internal.repo/snapshots\"
- \"releases\" \"https://internal.repo/releases\"
- \"alternate\" \"https://other.server/repo\"}
+ :repositories [[\"snapshots\" \"https://internal.repo/snapshots\"]
+ [\"releases\" \"https://internal.repo/releases\"]
+ [\"alternate\" \"https://other.server/repo\"]]
If you don't provide a repository name to deploy to, either \"snapshots\" or
\"releases\" will be used depending on your project's current version. See
View
3  todo.org
@@ -5,10 +5,11 @@ See also https://github.com/technomancy/leiningen/issues
* For 2.0.0
** 2.0.0-final
- [ ] Reduce verbosity of Aether. (#610)
- - [ ] Isolate target dir per profile (#468)
+ - [ ] Global offline flag. (#687)
- [ ] Honor mirror for search indices (#281)
- [ ] Allow search queries on any field. (#243)
- [ ] Drop clojars snapshots from default repos (#241)
+ - look at http://nullprogram.com/blog/2011/11/06/ ?
** 2.0.0-preview9
- [X] Fast trampolining
- [X] Latest newnew
Please sign in to comment.
Something went wrong with that request. Please try again.