Skip to content
robinkraft edited this page Jul 31, 2012 · 6 revisions

Forma-clj requires a few tools to get started.

Leiningen

Leiningen is the standard build tool for Clojure. Install instructions:

  1. Download the lein 2 preview or lein 1 stable script.
  2. Place it on your path. (I like to use ~/bin)
  3. Set it to be executable. (chmod 755 ~/bin/lein)

See the Leiningen github page for more information.

Swank

If you're using emacs, I recommend developing with Swank.

lein plugin install swank-clojure "1.4.0-SNAPSHOT"

GDAL Java bindings

The attached bindings were built for GDAL 1.8.0; specifically, the Macports hdf4 universal variant. To install GDAL properly, download the MacPorts DMG for Snow Leopard, and install away.

Once this completes, run the following commands at the terminal:

sudo port -v selfupdate
sudo port install gdal +hdf4 +universal

This will install GDAL 1.8.0 into /opt/local. It won't disturb any other version of gdal; we just need it to be in this particular directory because the native java bindings will be looking there.

Native Bindings & Path

Add the following to your .bash_profile or .bashrc:

export JAVA_LIBRARY_PATH=/opt/local/bin:$JAVA_LIBRARY_PATH

On OS X,

Emacs Config

To access forma-clj's tests using the clojure-mode on Marmalade, you'll need to modify the clojure-jump-to-test function. Hit C-h k C-c t to get the description of clojure-jump-to-test and a hyperlink to clojure-mode.el. Search for clojure-test-for and replace that and clojure-jump-to-test with the following:

(defun clojure-test-for (namespace)
  (let* ((namespace (clojure-underscores-for-hyphens namespace))
         (segments (split-string namespace "\\."))
         (before (subseq segments 0 clojure-test-ns-segment-position))
         (after (subseq segments clojure-test-ns-segment-position))
         (test-segments (append before after)))
    (mapconcat 'identity test-segments "/")))

(defun clojure-jump-to-test ()
  "Jump from implementation file to test."
  (interactive)
  (find-file (format "%s/test/%s_test.clj"
                     (locate-dominating-file buffer-file-name "src/")
                     (clojure-test-for (clojure-find-ns)))))

Hit C-x C-e at the end of each form to eval, then jump back to a clojure file in forma-clj. C-c t should now jump you into tests with no problems. (I use C-x b <return> to jump back to the original source file.)

Thrift

As of April 2012, we're using thrift 0.8. Use the appropriate installation/compiling instructions for your platform. If you run into an issue with ruby rspec/rake, add --without-ruby to the ./configure command. Then run make, and sudo make install.

Local AWS Config

To access buckets, etc locally, add the following to your .bash_profile:

export AWS_KEY="<your-aws-key>"
export AWS_SECRET="<your-aws-secret>"

Generating Documentation

API Docs

If you don't have it already, install the codox plugin:

lein plugin install codox 0.3.1

And run

lein doc

To generate docs into ./docs.