Key leiningen-auth by URL instead of repo name.

This commit is contained in:
Phil Hagelberg 2011-02-18 20:43:17 -08:00
parent d839074a96
commit 338dbbc36c
2 changed files with 5 additions and 4 deletions

View file

@ -36,7 +36,8 @@ You can set authentication options keyed by repository name in
~/.lein/init.clj to avoid checking sensitive information into source
control:
(def leiningen-auth {\"releases\" {:passphrase \"vorpalbunny\"}})
(def leiningen-auth {\"https://blueant.com/archiva/internal\"
{:passphrase \"vorpalbunny\"}})
"
([project repository-name]
(doto (DeployTask.)

View file

@ -11,9 +11,9 @@
(org.apache.maven.settings Server)
(org.apache.tools.ant.util FlatFileNameMapper)))
(defn make-auth [id settings]
(defn make-auth [settings]
(let [user-options (when-let [user-opts (resolve 'user/leiningen-auth)]
(get @user-opts id))
(get @user-opts (:url settings)))
{:keys [username password passphrase
private-key] :as settings} (merge user-options settings)
auth (Authentication.)]
@ -31,7 +31,7 @@
settings)]
(.setId repo id)
(.setUrl repo (:url settings))
(when-let [auth (make-auth id settings)]
(when-let [auth (make-auth settings)]
(.addAuthentication repo auth))
repo))