Permalink
Browse files

update to uncle 0.2.2

  • Loading branch information...
1 parent 9981387 commit dd6fbcae02c8dfc32cd9d9c45d78cb12036b07d9 @ninjudd committed Jun 23, 2011
View
2 project.clj
@@ -2,7 +2,7 @@
:description "Save your fork, there's cake!"
:dependencies [[clojure "1.2.0"]
[clojure-contrib "1.2.0"]
- [uncle "0.2.1"]
+ [uncle "0.2.2"]
[classlojure "0.5.0"]
[clojure-useful "0.3.8"]
[com.jcraft/jsch "0.1.42"]
View
18 src/cake/file.clj
@@ -36,33 +36,27 @@
(defn cp [from to & opts]
(ant Copy
- (into-map opts :file from :tofile to)
- execute))
+ (into-map opts :file from :tofile to)))
(defn mv [from to & opts]
(ant Move
- (into-map opts :file from :tofile to)
- execute))
+ (into-map opts :file from :tofile to)))
(defn touch [file & opts]
(ant Touch
- (into-map opts :file file)
- execute))
+ (into-map opts :file file)))
(defn rm [file & opts]
(ant Delete
- (into-map opts :file file)
- execute))
+ (into-map opts :file file)))
(defn rmdir [file & opts]
(ant Delete
- (into-map opts :dir file)
- execute))
+ (into-map opts :dir file)))
(defn mkdir [file & opts]
(ant Mkdir
- (into-map opts :dir file)
- execute))
+ (into-map opts :dir file)))
(defn newer? [& args]
(apply > (for [arg args]
View
10 src/cake/tasks/compile.clj
@@ -1,7 +1,7 @@
(ns cake.tasks.compile
(:use cake
[cake.core :only [deftask bake]]
- [uncle.core :only [ant add-fileset fileset-seq path classpath execute]]
+ [uncle.core :only [ant add-fileset fileset-seq path classpath]]
[cake.file :only [file newer?]]
[cake.project :only [reset-classloaders! with-classloader]]
[bake.core :only [verbose? debug? log os-name os-arch]]
@@ -23,8 +23,7 @@
:debug-level "source,lines"
:target "1.5"
:failonerror true}
- (:java-compile *project*))
- execute))
+ (:java-compile *project*))))
(when (some #(newer? % start) (file-seq (file "classes")))
(reset-classloaders!))))
@@ -50,8 +49,7 @@
(let [os-name (os-name)
os-arch (os-arch)]
(ant Copy {:todir (format "native/%s/%s" os-name os-arch)}
- (add-fileset {:dir (format "build/native/%s/%s/lib" os-name os-arch)})
- execute)))
+ (add-fileset {:dir (format "build/native/%s/%s/lib" os-name os-arch)}))))
(deftask compile #{deps compile-native compile-java}
"Compile all clojure and java source files. Use 'cake compile force' to recompile."
@@ -66,7 +64,7 @@
(compile-clojure (source-dir) jar-classes [(:main *project*)]))))
;; add actions to compile-native if you need to compile native libraries
-;; see http://github.com/lancepantz/tokyocabinet for an example
+;; see http://github.com/flatland/tokyocabinet for an example
(deftask compile-native)
(deftask install-native #{compile-native}
View
29 src/cake/tasks/deps.clj
@@ -21,15 +21,15 @@
(defn add-license [task attrs]
(when attrs
(.addConfiguredLicense task
- (ant* License attrs))))
+ (ant-type License attrs))))
(defn add-repositories [task repositories]
(doseq [[id url] repositories]
(.addConfiguredRemoteRepository task
- (ant* RemoteRepository {:id id :url url}))))
+ (ant-type RemoteRepository {:id id :url url}))))
(defn exclusion [dep]
- (ant* Exclusion {:group-id (group dep) :artifact-id (name dep)}))
+ (ant-type Exclusion {:group-id (group dep) :artifact-id (name dep)}))
(defn- add-dep [task dep]
(if (instance? Pom task)
@@ -39,7 +39,7 @@
(defn add-dependencies [task deps]
(doseq [[dep opts] deps]
(add-dep task
- (ant* Dependency
+ (ant-type Dependency
{:group-id (group dep)
:artifact-id (name dep)
:version (:version opts)
@@ -67,22 +67,18 @@
(defn extract-native [jars dest]
(doseq [jar jars]
(ant Copy {:todir (str dest "/native") :flatten true}
- (add-zipfileset {:src jar :includes (format "native/%s/%s/*" (os-name) (os-arch))})
- execute)
+ (add-zipfileset {:src jar :includes (format "native/%s/%s/*" (os-name) (os-arch))}))
(ant Copy {:todir dest :flatten true}
- (add-zipfileset {:src jar :includes "lib/*.jar" })
- execute)))
+ (add-zipfileset {:src jar :includes "lib/*.jar" }))))
(defn fetch [deps dest]
(when (seq deps)
(let [ref-id (str "cake.deps.fileset." (.getName dest))]
(ant DependenciesTask {:fileset-id ref-id :path-id (:name *project*)}
- (add-repositories (into repositories (:repositories *project*)))
- (add-dependencies deps)
- execute)
+ (add-repositories (into repositories (:repositories *project*)))
+ (add-dependencies deps))
(ant Copy {:todir dest :flatten true}
- (.addFileset (get-reference ref-id))
- execute)))
+ (.addFileset (get-reference ref-id)))))
(extract-native
(fileset-seq {:dir dest :includes "*.jar"})
dest))
@@ -163,11 +159,8 @@
(binding [*exclusions* ['clojure 'clojure-contrib]]
(fetch (:dev-dependencies *project*) (file "build/lib/dev")))
(when (.exists (file "build/lib"))
- (ant Delete {:dir (first (:library-path *project*))}
- execute)
- (ant Move {:file "build/lib" :tofile (first (:library-path *project*))
- :verbose true}
- execute))
+ (ant Delete {:dir (first (:library-path *project*))})
+ (ant Move {:file "build/lib" :tofile (first (:library-path *project*)) :verbose true}))
(invoke clean {}))
(defn stale-deps? [deps-str deps-file]
View
8 src/cake/tasks/file.clj
@@ -2,7 +2,7 @@
(:use cake
[cake.core :only [deftask]]
[cake.task :only [run-task]]
- [uncle.core :only [ant add-fileset execute]]
+ [uncle.core :only [ant add-fileset]]
[cake.project :only [reset-classloaders!]]
[cake.file :only [file]]
[bake.core :only [log]])
@@ -19,15 +19,13 @@
(ant Delete {:verbose true}
(add-fileset {:dir (file) :includes "*.jar"})
(add-fileset {:dir (file) :includes "*.war"})
- (add-fileset {:dir (file ".cake" "run") :includes "*"})
- (execute))
+ (add-fileset {:dir (file ".cake" "run") :includes "*"}))
(doseq [dir ["classes" "build" "test/classes"]]
(clean-dir (file dir)))
(when (= ["deps"] (:clean *opts*))
(clean-dir (file "lib"))
(ant Delete {:verbose true}
- (add-fileset {:dir (file) :includes "pom.xml"})
- (execute)))
+ (add-fileset {:dir (file) :includes "pom.xml"})))
(reset-classloaders!))
(deftask file
View
67 src/cake/tasks/jar.clj
@@ -64,41 +64,36 @@
(defn build-context []
(ant Copy {:todir "build/jar" :overwrite true}
- (add-zipfileset (bakepath :includes "cake.clj"))
- execute)
+ (add-zipfileset (bakepath :includes "cake.clj")))
(let [cake-clj "build/jar/cake.clj"
context (current-context)
project (project-with-context context)]
- (ant Replace {:file cake-clj :token "(comment project)" :value (pr-str `(quote ~project))}
- execute)
+ (ant Replace {:file cake-clj :token "(comment project)" :value (pr-str `(quote ~project))})
(when (nil? context)
- (ant Replace {:file cake-clj :token "(comment context)" :value (pr-str `(quote ~*context*))}
- execute))))
+ (ant Replace {:file cake-clj :token "(comment context)" :value (pr-str `(quote ~*context*))}))))
(defn build-jar []
(let [maven (format "META-INF/maven/%s/%s" (:group-id *project*) (:artifact-id *project*))
cake (format "META-INF/cake/%s/%s" (:group-id *project*) (:artifact-id *project*))]
(when (:bake *project*)
(build-context))
- (let [task
- (ant Jar {:dest-file (jarfile)}
- (add-manifest (manifest))
- (add-license)
- (add-source-files)
- (add-zipfileset {:dir (file) :prefix maven :includes "pom.xml"})
- (add-zipfileset {:dir (file) :prefix cake :includes "*.clj"})
- (add-fileset {:dir (file "classes") :includes "**/*.class"})
- (add-fileset {:dir (file "build" "jar")})
- (add-zipfileset {:dir (file "native") :prefix "native"})
- (add-file-mappings (:jar-files *project*)))]
+ (let [task (ant-type Jar {:dest-file (jarfile)}
+ (add-manifest (manifest))
+ (add-license)
+ (add-source-files)
+ (add-zipfileset {:dir (file) :prefix maven :includes "pom.xml"})
+ (add-zipfileset {:dir (file) :prefix cake :includes "*.clj"})
+ (add-fileset {:dir (file "classes") :includes "**/*.class"})
+ (add-fileset {:dir (file "build" "jar")})
+ (add-zipfileset {:dir (file "native") :prefix "native"})
+ (add-file-mappings (:jar-files *project*)))]
(doseq [rsrc-path (:resources-path *project*)]
(add-fileset task {:dir (file rsrc-path)}))
(execute task))))
(defn clean [pattern]
(when (:clean *opts*)
- (ant Delete {:dir (file) :includes pattern}
- execute)))
+ (ant Delete {:dir (file) :includes pattern})))
(deftask jar #{compile}
"Build a jar file containing project source and class files."
@@ -144,8 +139,7 @@
(ant Jar {:dest-file (uberjarfile) :duplicate "preserve"}
(add-manifest (manifest))
(add-jars jars)
- (add-fileset {:dir (file "build" "uberjar")})
- execute)))
+ (add-fileset {:dir (file "build" "uberjar")}))))
(deftask uberjar #{jar}
"Create a standalone jar containing all project dependencies."
@@ -166,8 +160,7 @@
(.write bin (.getBytes unix))
(.write bin (.getBytes dos)))
(copy uberjar bin))
- (ant Chmod {:file binfile :perm "+x"}
- execute)))
+ (ant Chmod {:file binfile :perm "+x"})))
(println "Cannot create bin without :main namespace in project.clj")))
(defn warfile [] (artifact :war-name ".war"))
@@ -176,16 +169,15 @@
(let [web "WEB-INF"
classes (str web "/classes")]
(build-context)
- (let [task
- (ant War {:dest-file (warfile)}
- (add-manifest (manifest))
- (add-license)
- (add-source-files "WEB-INF/classes")
- (add-zipfileset {:dir (file "src") :prefix web :includes "*web.xml"})
- (add-zipfileset {:dir (file "classes") :prefix classes :includes "**/*.class"})
- (add-zipfileset {:dir (file "build" "jar") :prefix classes})
- (add-fileset {:dir (file "build" "war")})
- (add-file-mappings (:war-files *project*)))]
+ (let [task (ant-type War {:dest-file (warfile)}
+ (add-manifest (manifest))
+ (add-license)
+ (add-source-files "WEB-INF/classes")
+ (add-zipfileset {:dir (file "src") :prefix web :includes "*web.xml"})
+ (add-zipfileset {:dir (file "classes") :prefix classes :includes "**/*.class"})
+ (add-zipfileset {:dir (file "build" "jar") :prefix classes})
+ (add-fileset {:dir (file "build" "war")})
+ (add-file-mappings (:war-files *project*)))]
(doseq [rsrc-path (:resources-path *project*)]
(add-zipfileset task {:dir (file rsrc-path)
:prefix classes :includes "**/*"}))
@@ -201,16 +193,13 @@
(defn build-uberwar []
(ant War {:dest-file (warfile) :update true}
(add-zipfileset {:dir (file (:library-path *project*))
- :prefix "WEB-INF/lib" :includes "*.jar"})
- execute))
+ :prefix "WEB-INF/lib" :includes "*.jar"})))
(deftask uberwar #{war}
"Create a web archive containing all project dependencies."
(build-uberwar))
(deftask install #{jar}
"Install jar to local repository."
- (ant Pom {:file "pom.xml" :id "cake.pom"}
- execute)
- (ant InstallTask {:file (jarfile) :pom-ref-id "cake.pom"}
- execute))
+ (ant Pom {:file "pom.xml" :id "cake.pom"})
+ (ant InstallTask {:file (jarfile) :pom-ref-id "cake.pom"}))
View
3 src/cake/tasks/new.clj
@@ -35,8 +35,7 @@
(do
(log (str "Creating a new project based on ~/.cake/templates/" template))
(ant Copy {:todir root}
- (add-fileset {:dir (str (file template-dir template))})
- execute)
+ (add-fileset {:dir (str (file template-dir template))}))
(rename-files root project)
(scan-replace-contents (file-seq root) project)))))
View
3 src/cake/tasks/version.clj
@@ -41,8 +41,7 @@
(let [new-version (if (= "bump" action) (version-str (bump)) action)]
(ant Replace {:file "project.clj"
:token (defline (:version *project*))
- :value (defline new-version)}
- execute)
+ :value (defline new-version)})
new-version))
(deftask version
View
15 src/cake/utils.clj
@@ -1,7 +1,7 @@
(ns cake.utils
(:use cake
[cake.file :only [file]]
- [uncle.core :only [ant args argline execute]]
+ [uncle.core :only [ant args argline]]
[bake.core :only [os-name]])
(:import (org.apache.tools.ant.taskdefs ExecTask)))
@@ -19,22 +19,19 @@
:input-string (str password "\n")}]
(if (= "linux" (os-name))
(ant ExecTask (assoc opts :executable "script")
- (argline (apply str "-q -c 'sudo -S "
- (interpose " " (conj arglist "' /dev/null"))))
- execute)
+ (argline (apply str "-q -c 'sudo -S "
+ (interpose " " (conj arglist "' /dev/null")))))
(ant ExecTask (assoc opts :executable "sudo")
- (args (apply vector "-S" arglist))))))
+ (args (apply vector "-S" arglist))))))
(defn cake-exec [& params]
(ant ExecTask {:executable "ruby" :dir *root* :failonerror true}
- (args *script* params (str "--project=" *root*))
- execute))
+ (args *script* params (str "--project=" *root*))))
(defn git [& params]
(if (.exists (file ".git"))
(ant ExecTask {:executable "git" :dir *root* :failonerror true}
- (args params)
- execute)
+ (args params))
(println "warning:" *root* "is not a git repository")))
(defn ftime [string time]
View
36 tasks.clj
@@ -24,33 +24,26 @@
(let [jarfile (uberjarfile)
bakejar (bakejar)]
(ant Jar {:dest-file bakejar}
- (add-fileset {:dir "dev"})
- add-dev-jars
- execute)
+ (add-fileset {:dir "dev"})
+ add-dev-jars)
(ant Jar {:dest-file jarfile :update true}
- (add-fileset {:file bakejar})
- add-dev-jars
- execute)))
+ (add-fileset {:file bakejar})
+ add-dev-jars)))
(deftask gem
"Build standalone gem package."
(let [version (:version *project*)]
(if (snapshot? version)
(println "refusing to make gem since this is a snapshot version:" version)
(do (invoke uberjar)
- (ant Copy {:file (uberjarfile) :tofile (file "gem/lib/cake.jar")}
- execute)
- (ant Copy {:file (bakejar) :tofile (file "gem/lib/bake.jar")}
- execute)
+ (ant Copy {:file (uberjarfile) :tofile (file "gem/lib/cake.jar")})
+ (ant Copy {:file (bakejar) :tofile (file "gem/lib/bake.jar")})
(ant Copy {:tofile (file "gem/lib/clojure.jar")}
- (add-fileset {:dir "lib" :includes (clojure-jar)})
- execute)
- (ant Copy {:file (file "bin/cake") :tofile (file "gem/bin/cake")}
- execute)
+ (add-fileset {:dir "lib" :includes (clojure-jar)}))
+ (ant Copy {:file (file "bin/cake") :tofile (file "gem/bin/cake")})
(ant ExecTask {:executable "gem" :dir (file "gem")}
- (env {"CAKE_VERSION" version})
- (args ["build" "cake.gemspec"])
- execute)))))
+ (env {"CAKE_VERSION" version})
+ (args ["build" "cake.gemspec"]))))))
(undeftask release)
(deftask release #{uberjar gem tag}
@@ -61,12 +54,10 @@
jar (format "jars/cake-%s.jar" version)]
(with-root (file "releases")
(git "pull"))
- (ant Copy {:file (uberjarfile) :tofile (file "releases" jar)}
- execute)
+ (ant Copy {:file (uberjarfile) :tofile (file "releases" jar)})
(spit (file "releases/current") version)
(when-not snapshot?
- (ant Copy {:file (file "bin" "cake") :tofile (file "releases" "cake")}
- execute)
+ (ant Copy {:file (file "bin" "cake") :tofile (file "releases" "cake")})
(spit (file "releases/stable") version))
(with-root (file "releases")
(git "add" jar "cake" "current" "stable")
@@ -76,5 +67,4 @@
(let [gem (str "cake-" version ".gem")]
(log "Releasing gem:" gem)
(ant ExecTask {:executable "gem" :dir (file "gem")}
- (args ["push" gem])
- execute)))))
+ (args ["push" gem]))))))

0 comments on commit dd6fbca

Please sign in to comment.