Permalink
Browse files

Merge pull request #13 from slagyr/master

supports leiningen 2 exit code strategy for tasks
  • Loading branch information...
2 parents a3085f3 + 2ff0a19 commit e694fc1802420248e80d26683a4de11eb1a554ec @ato committed Aug 28, 2012
Showing with 16 additions and 7 deletions.
  1. +2 −2 README.md
  2. +1 −1 project.clj
  3. +13 −4 src/leiningen/push.clj
View
@@ -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 --
View
@@ -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"]])
View
@@ -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)))))

0 comments on commit e694fc1

Please sign in to comment.