Home

Awesome

thing-babel

A Leiningen project template for literate Clojure & Clojurescript projects w/ Emacs & org-mode.

This template does not create a working Lein project directory per se, but constitutes more of a meta Lein template consisting of a several .org files (most importantly readme.org) which contains both a structured template for a library README and a parametric description of the Lein project to be generated and regenerated in the future. These .org files must be tangled with the supplied tangle.sh script and will generate a working lein project directory from those.

0.3.2.2 - 2015-08-30

0.3.2 - 2015-08-29

0.3.1 - 2015-08-28

0.3.0 - 2015-08-14

0.2.3

0.2.0

New in version 0.2.0 is also the presence of libraryofbabel.org, org-mode's mechanism to support re-usable & parametric code templates. The generated .org file for the main namespace demonstrates the use of such code templates (albeit in a very construed way). A much better and more realistic use for these templates is to provide skeleton implementations when working with Clojure protocols. See thi.ng/geom for a concrete example.

Objective

The template is aimed at an x-platform CLJX project structure and configures a Lein project with the currently latest versions of:

Usage

The project name given can be fully qualified (as in the example below), however the created directory will only take the last name part minus the leading group ID (if any). The fully qualified name is used to define namespaces & target paths within the generated .org files and will also be inserted into the resulting project.clj file.

lein new thing-babel org.foo/bar \
  author "my name" \
  email "a@b.com" \
  url "http://project.com" \
  author-url "http://home.com" \
  license ASL \
  target generated \
  desc "Another great project"

Generating fresh literate programming project: org.foo/bar
generated project dir   : bar
artefact group ID       : org.foo
project url             : http://project.com
project author          : my name
author url              : http://home.com
author email            : a@b.com
license                 : Apache Software License 2.0
description             : Another great project
path for gen sources    : generated/
project root namespace  : org.foo.bar

# switch into newly created project folder
cd bar

# (re)generate actual lein project & sources
./tangle-all.sh 

# switch into generated project (value of `target` key above)
cd generated

# trigger cleaning, cljx processing & testing
lein test org.foo.bar.test.core

FAIL in (epic-fail) (core.clj:12)
FIXME
expected: (= 3 (+ 1 1))
  actual: (not (= 3 2))

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
Tests failed.

Success!

Apart from the project name all other options are optional (indeed). If omitted, some values will assume the following defaults:

Misc

I recommend using the Emacs Leuven theme for a great org-mode experience...

In order to automatically update the TOC of each org file, I too recommend installing the toc-org package Emacs package.