Skip to content

Commit

Permalink
Allow user-level repositories which contain credentials only.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jun 27, 2012
1 parent 1d2674a commit 5775c6a
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions leiningen-core/src/leiningen/core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
(into (if-not omit-default-repositories
(:repositories defaults)
(ordered/ordered-map))
(for [[id repo] repositories]
(for [[id repo] repositories
;; user-level :repos entries may contain just credentials
:when (or (string? repo) (:url repo))]
[id (if (map? repo) repo {:url repo})]))))

(defn- without-version [[id version & other]]
Expand Down Expand Up @@ -188,23 +190,29 @@
(recur profiles result)
result)))

(defn- warn-user-repos []
(when (->> (vals (user/profiles))
(map (comp vals :repositories))
(apply concat) (some :url))
(println "WARNING: :repositories detected in user-level profile!")
(println "See https://github.com/technomancy/leiningen/wiki/Repeatability")))

(alter-var-root #'warn-user-repos memoize)

(defn- profiles-for
"Read profiles from a variety of sources.
We check Leiningen's defaults, the profiles.clj file in ~/.lein/profiles.clj,
the profiles.clj file in the project root, and the :profiles key from the
project map."
[project profiles-to-apply]
(let [user-profiles (user/profiles)]
(when (some (comp :repositories val) user-profiles)
(println "WARNING: :repositories detected in user-level profile!")
(println "See https://github.com/technomancy/leiningen/wiki/Repeatability"))
(let [profiles (merge @default-profiles user-profiles (:profiles project))]
;; We reverse because we want profile values to override the
;; project, so we need "last wins" in the reduce, but we want the
;; first profile specified by the user to take precedence.
(map #(if (keyword? %) (lookup-profile profiles %) %)
(reverse profiles-to-apply)))))
(warn-user-repos)
(let [profiles (merge @default-profiles (user/profiles) (:profiles project))]
;; We reverse because we want profile values to override the
;; project, so we need "last wins" in the reduce, but we want the
;; first profile specified by the user to take precedence.
(map #(if (keyword? %) (lookup-profile profiles %) %)
(reverse profiles-to-apply))))

(defn ensure-dynamic-classloader []
(let [thread (Thread/currentThread)
Expand Down

0 comments on commit 5775c6a

Please sign in to comment.