diff --git a/README.md b/README.md index 8344217..ea21cf9 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ Setup Add lein-clojars as a Leiningen (1.x) plugin: - lein plugin install lein-clojars 0.9.0 + lein plugin install lein-clojars 0.9.1 Or for Leiningen 2 add it to ~/.lein/profiles.clj: - {:user {:plugins [[lein-clojars "0.9.0"]]}} + {:user {:plugins [[lein-clojars "0.9.1"]]}} Create a Clojars account and paste your SSH public key into your [profile] [1]. If you don't have ssh-keygen available -- perhaps you're using Windows -- diff --git a/project.clj b/project.clj index 794e455..5c985f0 100644 --- a/project.clj +++ b/project.clj @@ -1,3 +1,3 @@ -(defproject lein-clojars "0.9.0" +(defproject lein-clojars "0.9.1" :description "Leiningen plugin for interacting with Clojars.org." :dependencies [[com.jcraft/jsch "0.1.42"]]) diff --git a/src/leiningen/push.clj b/src/leiningen/push.clj index d717906..f449e1c 100644 --- a/src/leiningen/push.clj +++ b/src/leiningen/push.clj @@ -7,9 +7,9 @@ (let [re-repo #"(?:([^@]+)@)?([^:]+)(?::(\d+))?(?::(.*))?"] (defn parse-repo [repo] - (let [[_ user host port path] (re-matches re-repo + (let [[_ user host port path] (re-matches re-repo (or repo "clojars@clojars.org"))] - [(or user (System/getProperty "user.name")) + [(or user (System/getProperty "user.name")) host (if port (Integer/parseInt port) 22) (or path ".")]))) @@ -64,6 +64,13 @@ (.disconnect channel) (.disconnect session))))) +(defn- exit [code] + (try + (require 'leiningen.core.main) + ((ns-resolve (the-ns 'leiningen.core.main) 'exit) code) + (catch java.io.FileNotFoundException e + code))) + (defn push "Push a jar to the Clojars.org repository over scp" [project & [repo]] @@ -78,14 +85,16 @@ (jar project) (try (scp-send repo pomfile jarfile) + (exit 0) (catch JSchException e (.printStackTrace e) (when (= (.getMessage e) "Auth fail") - (println + (println (str "\nIf you're having trouble authenticating, try using\n" "a key generated by 'lein keygen'. lein-clojars doesn't\n" "work yet with DSA or passphrased keys. I'm working\n" "on fixing this. You can also push directly with scp:\n\n" "lein pom\n" - "scp " pomfile " " jarfile " clojars@clojars.org:" ))))))) + "scp " pomfile " " jarfile " clojars@clojars.org:" ))) + (exit -1)))))