Created
August 22, 2010 00:35
-
-
Save edgargoncalves/543090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; prepare our namespaces to the build-script: | |
(ns leiningen.deploy | |
(use [lancet :only [ant exec]] ; add other needed ant tasks here | |
[leiningen.uberjar :only [uberjar]] ; add other lein commands here | |
[leiningen.core :only [project]])) ; just so that we may call cmds | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; helper fns: | |
(defn call-external-ant | |
[target base-dir] | |
(println (apply str (take 80 (repeat "-")))) | |
(ant {:dir base-dir :target (name target) :inheritAll "true"}) | |
(println (apply str (take 80 (repeat "-")))) | |
(println "... external ant task finished!")) | |
(defn run-shell-command | |
[cmd] | |
(exec {:executable cmd :spawn "true"})) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; the next fn should be callable with `lein deploy`. | |
(defn deploy | |
"Performs a set of steps, including ant tasks on other projs and shell cmds." | |
[project & args] | |
(uberjar project) ;; make an uberjar out of this clojure project | |
;; make one jar: | |
(println "Firing up 'ant jar' on an external project ...") | |
(call-external-ant :jar "/path/to/external/project/1/") | |
;; deploy to tomcat: | |
(println "firing up 'ant deploy' on another external project") | |
(call-external-ant :deploy "/path/to/external/project/2/") | |
;; kill tomcat, then fire up a fresh one: | |
(run-shell-command "shutdown.sh") ; assumes those two shell scripts in $PATH. | |
(run-shell-command "startup.sh")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment