I’m chipping away at my Mashup project tasks, namely an OAuth library for Twitter and other providers of protected resources. But I wanted to pass on a concrete contribution, so here are some tips about taking advantage of Clojure’s availability through git, and how to put your clojure-contrib library in sync with the big Clojure 1.0 release.
Clojure 1.0 is released, and you can get it as a ZIP file:
Unzip it, and everything you need is there, including a JAR file, clojure_1.0.0.jar.
I had to rename a few things, since my CLASSPATH expects a JAR called simply ‘clojure.jar’ in a folder called ‘clojure’. After I renamed/backed up my existing clojure directory, I copied the unzipped clojure_1.0.0 folder into its place and renamed it. I also created a clojure.jar link, via
ln to clojure_1.0.0.jar.
Now for the clojure-contrib. Stuart Sierra did us the favor of setting up a branch of clojure-contrib development that is intended to be compatible with the Clojure 1.0 release. Here’s Stuart’s announcement.
First, I needed to clone the git repo. I renamed/backed up my old clojure-contrib folder and then issued this command:
> git clone git://github.com/richhickey/clojure-contrib.git
This initialized a repository tracking the master branch. To get the latest 1.0-compatible code, I needed to track the branch ‘clojure-1.0-compatible’. Following advice from ENTP, I determined the form of the command to issue was:
git branch --track local origin/remote && git checkout local
For example, I decided to call my tracking branch ‘1.0’, so I issued:
> git branch --track 1.0 origin/clojure-1.0-compatible && git checkout 1.0
Then, to pull down a copy of this branch:
> git pull
That’s all there is too it. Then I was ready to build my JAR’s:
> ant -Dclojure.jar=../clojure/clojure.jar
First entirely painless Clojure update ever!
If you’re comfy with git, you’ll want to decide on whether to ignore the generated files or commit them. Of course, you can’t push to the remote source, so it really doesn’t matter.