-
Notifications
You must be signed in to change notification settings - Fork 1
Icing
Icing is a way to automatically load the external dependencies for a .clj file before running it. It is the Clojure equivalent to Groovy's Grape.
(ns
^{:project {:dependencies [[clojure "1.2.0"]
[hiccup "0.3.0"]]
:entry lorem}}
example
(:use hiccup.core))
(defn lorem
[args]
(println (html [:span {:class "lorem"} "ipsom"])))
Running cake icing example.clj will run the given file and entry function with it's meta data dependencies loaded into a new temporary class loader. These dependencies are resolved via Ivy, and downloaded if they are not already in the ivy cache. Dependencies are not copied to a local lib directory; they are used directly from the cache. The persistent Cake JVM is used so it is very fast if the dependencies are already cached and dynamic revisions aren't being used.
,-[lrenn@cygnus]-[~/src/icing]-[0]-[9135]
`-[:)] % time cake icing example.clj
[icing] :: loading settings :: url = jar:file:/home/lrenn/src/cake/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[icing] :: resolving dependencies :: icing#icing;0.0.1-SNAPSHOT
[icing] confs: [master, default, devel]
[icing] found org.clojure#clojure;1.2.0 in public
[icing] found hiccup#hiccup;0.3.0 in clojars
[icing] found org.clojure#clojure-contrib;1.2.0 in clojure
[icing] :: resolution report :: resolve 66ms :: artifacts dl 4ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| master | 0 | 0 | 0 | 0 || 0 | 0 |
| default | 3 | 0 | 0 | 0 || 3 | 0 |
| devel | 0 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
<span class="lorem">ipsom</span>
cake icing example.clj 0.10s user 0.01s system 40% cpu 0.269 total
The icing target is currently on Cake's Ivy branch. Follow the directions for Testing Ivy Support on the Ivy wiki page. Your entry function must take a single parameter. Currently only "" is passed, but command line arguments will eventually be passed. It should not be run in a project directory. I need to pin it to the global project.
- Even though entry must take a single parameter, I'm not passing the command line arguments for it.
- It would be nice if you could pass system properties.
- Ensure it's always run in the global project.
- Come up with a better name, syntax for meta data keys.