Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit; 90% of the way there.

  • Loading branch information...
commit de5800ae16b3d00c21ff57d5f23afc8bed0c31b1 0 parents
@technomancy authored
4 .gitignore
@@ -0,0 +1,4 @@
+pom.xml
+*jar
+lib
+classes
21 README
@@ -0,0 +1,21 @@
+# lein-release
+
+ How far could you take a jar if the jar was in a tar? Possibly as
+ far as Myanmar.
+
+Package your project up as a tarball!
+
+## Usage
+
+ $ lein release
+
+Creates myproject-1.0.0.tar including everything in pkg/ along with
+all dependencies plus the jar of your project.
+
+## Installation
+
+Add [lein-release "1.0.0-SNAPSHOT"] to your project's :dev-dependencies
+
+## License
+
+Licensed under the EPL; the same license as Clojure.
1  pkg/bin/heyo
@@ -0,0 +1 @@
+hi there
1  pkg/etc/foo.conf
@@ -0,0 +1 @@
+don't conf me, man!
8 project.clj
@@ -0,0 +1,8 @@
+(defproject lein-release "1.0.0-SNAPSHOT"
+ :description "FIXME: write"
+ ;; TODO: remove these deps; they're implied by lein; used for testing.
+ :dependencies [[ant/ant "1.6.5"]]
+ :dev-dependencies [[swank-clojure "1.2.0-SNAPSHOT"]
+ [org.apache.maven/maven-ant-tasks "2.0.10"]
+ [clojure "1.2.0-master-SNAPSHOT"]
+ [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]])
22 src/leiningen/release.clj
@@ -0,0 +1,22 @@
+(ns leiningen.release
+ (:use [leiningen.jar :only [jar]]
+ [clojure.contrib.io :only [file]])
+ (:import [org.apache.tools.tar TarOutputStream TarEntry]
+ [java.io FileOutputStream]))
+
+(defn- add-file [tar f]
+ (println "adding" f)
+ (.putNextEntry tar (TarEntry. f)))
+
+(defn release [project]
+ (let [jar-file (jar project)
+ tar-file (file (format "%s/%s-%s.tar" (:root project)
+ (:name project) (:version project)))]
+ (with-open [tar (TarOutputStream. (FileOutputStream. tar-file))]
+ (doseq [p (file-seq (file (:root project)
+ (or (:pkg-path project) "pkg")))]
+ (add-file tar p))
+ (doseq [j (filter #(re-find #"\.jar$" (.getName %))
+ (.listFiles (file (:library-path project))))]
+ (add-file tar j))
+ (add-file tar (file jar-file)))))
6 test/leiningen/test_release.clj
@@ -0,0 +1,6 @@
+(ns lein-release.core-test
+ (:use [lein-release.core] :reload-all)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false))
Please sign in to comment.
Something went wrong with that request. Please try again.