Work with latest pomegranate deploy-artifacts signature.

This commit is contained in:
Phil Hagelberg 2012-06-14 22:00:06 -07:00
parent 2fffac4854
commit 70695f5868
3 changed files with 30 additions and 29 deletions

View file

@ -9,7 +9,7 @@
[ordered "1.2.0"]
;; currently using this branch:
;; https://github.com/cemerick/pomegranate/pull/27
[com.cemerick/pomegranate "0.0.13-SNAPSHOT"
[com.cemerick/pomegranate "0.0.13"
:exclusions [org.slf4j/slf4j-api]]]
;; This is only used when releasing Leiningen. Can't put it in a
;; profile since it must be installed using lein1

View file

@ -30,26 +30,6 @@
(into-array ["Password: "]))]
[id (assoc settings :username username :password password)]))))
(defn sign [file]
(let [exit (binding [*out* (java.io.StringWriter.)]
(eval/sh "gpg" "--yes" "-ab" file))]
(when-not (zero? exit)
(main/abort "Could not sign" file))
(io/file (str file ".asc"))))
(defn signatures-for [jar-file pom-file]
[[(sign jar-file) :extension "jar.asc"]
[(sign pom-file) :extension "pom.asc"]])
(defn files-for [project repo]
(let [jar-file (jar/jar project)
pom-file (pom/pom project)]
(concat [[jar-file :extension "jar"]
[pom-file :extension "pom"]]
(if (and (:sign-releases (second repo) true)
(not (.endsWith (:version project) "-SNAPSHOT")))
(signatures-for jar-file pom-file)))))
(defn repo-for [project repository-name]
;; can't use merge here due to bug in ordered maps:
;; https://github.com/flatland/ordered/issues/4
@ -62,6 +42,27 @@
repo (add-auth-interactively repo)]
repo))
(defn sign [file]
(let [exit (binding [*out* (java.io.StringWriter.)]
(eval/sh "gpg" "--yes" "-ab" file))]
(when-not (zero? exit)
(main/abort "Could not sign" file))
(str file ".asc")))
(defn signatures-for [jar-file pom-file coords]
{(into coords [:extension "jar.asc"]) (sign jar-file)
(into coords [:extension "pom.asc"]) (sign pom-file)})
(defn files-for [project repo]
(let [coords [(symbol (:group project) (:name project)) (:version project)]
jar-file (jar/jar project)
pom-file (pom/pom project)]
(merge {(into coords [:extension "jar"]) jar-file
(into coords [:extension "pom"]) pom-file}
(if (and (:sign-releases (second repo) true)
(not (.endsWith (:version project) "-SNAPSHOT")))
(signatures-for jar-file pom-file coords)))))
(defn warn-missing-metadata [project]
(doseq [key [:description :license :url]]
(when (or (nil? (project key)) (re-find #"FIXME" (str (project key))))
@ -85,14 +86,11 @@ configure your credentials so you are not prompted on each deploy."
(let [repo (repo-for project repository-name)
files (files-for project repo)]
(try
(doseq [[file & coords] files]
(main/info "Deploying" file coords "to" repo)
(aether/deploy-file :coordinates (into [(symbol (:group project)
(:name project))
(:version project)] coords)
:file (io/file file)
:transfer-listener :stdout
:repository [repo]))
(main/debug "Deploying" files "to" repo)
(aether/deploy-artifacts :artifacts (keys files)
:files files
:transfer-listener :stdout
:repository [repo])
(catch org.sonatype.aether.deployment.DeploymentException e
(when main/*debug* (.printStackTrace e))
(main/abort (abort-message (.getMessage e)))))))

View file

@ -7,6 +7,9 @@
(defproject nomnomnom "0.5.0-SNAPSHOT"
:description "A test project"
:url "https://github.com/technomancy/leiningen/tree/master/test_projects"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[~(symbol "org.clojure" "clojure") ~clj-version]
[rome ~(str "0." "9")]
[ring "1.0.0"]]