Skip to content

Instantly share code, notes, and snippets.

Software: you can improve and redistribute it under the GNU General Public License, version 3 or later. Copyright (C) 2009 Free Software Foundation, Inc. (C) 2009 D. Reitter. No Warranty.
1.9 is the most recent Aquamacs version available.
Aquamacs is based on GNU Emacs, a part of the GNU/Linux system. It is Free Software: you can improve and redistribute it under the GNU General Public License, version 3 or later. Copyright (C) 2009 Free Software Foundation, Inc. (C) 2009 D. Reitter. No Warranty.
Loading /Users/David/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el (source)...done
This function is deprecated in favour of swank-clojure. See http://technomancy.us/swank-clojure for details. Abort? (y or n)
ad-Orig-error: Aborted!
Loading slime...
Loading slime-repl...done
Loading slime...done
Loading swank-clojure...done
;;; clj-html.core & compojure.html performance
;;; ORIGINALLY FOUND AT http://gist.github.com/45136
(use '[clj-html.core :rename {html htmlc htmli htmli2}]
'clj-html.utils
'[compojure.html :rename {html htmli}]
'[hiccup :rename {html hhtml escape-html hic-escape-html h hh}])
(defn- htmli-item-partial
[item]
(defprotocol PRandomAccessFile
""
(close [obj] "")
(position ([obj] [obj newpos]) ""))
(deftype RandomAccessBufferedFile
[#^java.nio.channels.FileChannel channel
#^java.nio.ByteBuffer buffer
#^long bufstart]
PRandomAccessFile
[{:eval [[cake/*opts* cake/*env* cake/*project*]], :env [qa]} nil {:environments {:qa {:foo 1, :bar 2}}, :dependencies {clojure {:version 1.2.0}, clojure-contrib {:version 1.2.0}, clojure-useful {:exclusions [clojure], :version 0.2.2}, swank-clojure {:version 1.2.1}, tokyocabinet {:version 1.23-SNAPSHOT}}, :group-id test-example, :dev-dependencies {clojure-complete {:version 0.1.0}, autodoc {:version 0.7.1}}, :name test-example, :tasks [foo :exclude [uberjar jar]], :version 0.1.0-SNAPSHOT, :aot nil, :artifact-id test-example, :description cake example project}]
[david@localhost test]$ cake -d
config: {}
vars: {:opts {:d [""]} :shellenv {"MAIL" "/var/spool/mail/david" "LS_COLORS" "no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:" "TERM" "xterm-color" "HOSTNAME" "localhost.localdomain" "SHLVL" "1" "SSH_TTY" "/dev/pts/5" "SSH_CONNECTION" "10.0.1.195 65351 10.0.1.12 22" "OLDPWD" "/home/david/bin/cake-src" "USER" "david" "SHELL" "/bin/bash" "SSH_CLIENT" "10.0.1.195 65351 22" "LESSOPEN" "|/usr/bin/lesspipe.sh %s" "LANG" "en_US.UTF-8" "PWD" "/home/david/bin/cake-src/examples/test" "HISTSIZE" "1000" "G_BROKEN_FILENAMES" "1" "LOGNAME" "david" "_" "/home/david/bin/cake" "HOME" "/home/david
[david@localhost servlet]$ cake swank 10.0.1.12:4005 --env=development
[bake.task.swank ((:require [bake.swank :as swank])) (let [] (if (not (swank/installed?)) (do (println "swank-clojure is not in your library path.") (println "add swank-clojure as a dev-dependency in ~/.cake/project.clj to enable")) (if (swank/running?) (let [num (swank/num-connections) s (if (= 1 num) "" "s")] (println (format "swank currently running on port %d with %d active connection%s" (clojure.core/deref swank/current-port) num s))) (if (swank/start (or (first (:swank *opts*)) "localhost:4005")) (println "started swank-clojure server on port" (clojure.core/deref swank/current-port)) (println "unable to start swank-clojure server, port already in use")))))] {:opts {:env ["development"], :swank ["10.0.1.12:4005"]}, :env {"SSH_CLIENT" "10.0.1.195 65351 22", "SSH_TTY" "/dev/pts/5", "HISTSIZE" "1000", "LESSOPEN" "|/usr/bin/lesspipe.sh %s", "PATH" "/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/david/bin", "LS_COLORS" "no=00:fi=00:d
[david@localhost servlet]$ cake swank 10.0.1.12:4005 --env=development
/home/david/bin/cake:537:in `inspect': undefined method `start_with?' for #<String:0x2b3af5aa8c68> (NoMethodError)
from /home/david/bin/cake:382:in `reload_stale_files'
from /home/david/bin/cake:555:in `with_socket'
from /home/david/bin/cake:374:in `reload_stale_files'
from /home/david/bin/cake:330:in `init'
from /home/david/bin/cake:852
[david@localhost servlet]$ cake kill all
[david@localhost servlet]$ cake swank 10.0.1.12:4005 --env=development
/home/david/bin/cake:72:in `wait': Interrupt
:contexts {:development {:db {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost:5432/site"
:user "site-web"
:password "password"}
:debug-mode true}
:release {:db {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost:5432/site"
:user "site-web"
(deftask pallet
"Launch pallet tasks from the command line."
(bake (:require [clojure.string :as str])
[options (:pallet *opts*)]
(do
(println (str "options are: " options))
(try
(require 'pallet.main)
(catch java.io.FileNotFoundException e
(println "Error loading pallet: " (.getMessage e))

cake-pallet

cake-pallet is a plugin to invoke pallet tasks using cake. Pallet is used as a library, so Pallet tasks are written as Clojure code you can keep in your project. By using cake to launch pallet, you can invoke your Pallet scripts without having to start a repl or write custom scripts.

Obtaining

In your project file, add