9

I've been learning some Clojure, and I currently have a single .clj file which I edit in a text editor and which I execute on the command line.

Where can I find a guide on the practical aspects of scaling this up to larger programs/libraries?

  • How should I lay out multiple .clj files on the filesystem?
  • How should I organize and execute test code?
  • How should I document the program/library?
  • How should I package it?

I'm looking for information on the practical aspects on scaling up from small scripts to something real.

pauldoo
  • 16,381
  • 20
  • 85
  • 112

3 Answers3

11

I recommend using leiningen. Running

$ lein new myproject

will create a new folder called myproject inside your current working directory with a default skeleton structure.

Inside the newly generatedmyproject folder you'll find (among others) a folder named src for clojure source code and a folder named test for your tests (leiningen will generate a default failing test).

Leiningen will let you run your tests with lein test.

You can package your project as a jar file with lein jar or create an uberjar (an executable jar with all required dependencies included) with lein uberjar.

For generating documentation I recommend autodoc which integrates nicely with leiningen.

mtyaka
  • 8,246
  • 1
  • 35
  • 40
  • Leiningen looks perfect, it contains a nice tutorial on how it works: http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md – pauldoo Nov 14 '10 at 20:45
2

If you are using Netbeans, there is a Clojure plugin which could be helpful to you.

Creating a Clojure project with it creates a bunch of folders: Source Packages, which contains a default package called com.yourcompany, Test Packages, Libraries, which contains the .jar for Clojure and a link to the JDK, and Test Libraries, which contains JUnit.

Alexis Dufrenoy
  • 11,106
  • 10
  • 73
  • 122
  • 1
    Is JUnit recommended for Clojure testing? I'd expect there to be something more Clojure-ish. – pauldoo Nov 14 '10 at 11:29
  • 1
    You can find more about unit testing in Clojure here: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Unit_Testing_in_Clojure – Alexis Dufrenoy Nov 14 '10 at 11:31
1

I use a combo of:

Good luck!

Alex Baranosky
  • 44,548
  • 39
  • 95
  • 146