Minimal ClojureScript example using Boot

1,135 views
Skip to first unread message

pand...@gmail.com

unread,
Jan 20, 2015, 8:48:47 PM1/20/15
to clojur...@googlegroups.com
https://github.com/pandeiro/jamal

Borrowing heavily from the 'mies' template, here's an example of a barebones client-side ClojureScript application that uses the Boot build tool in place of Leiningen.

My hope is that it illustrates, for anyone interested, some differences between the two approaches and allows for tinkering, tire-kicking, etc.

A productive 2015 to all!
M

J David Eisenberg

unread,
Jan 22, 2015, 7:22:24 AM1/22/15
to clojur...@googlegroups.com
Slightly off-topic: for people who are just beginning with ClojureScript, would you recommend using Leiningen or Boot, and why? (As I understand it, Boot is easier from the setup standpoint, but Leiningen has a longer track record / larger "infrastructure")

Gary Johnson

unread,
Jan 22, 2015, 12:06:33 PM1/22/15
to clojur...@googlegroups.com
Similarities between Leiningen and Boot:

1. Same installation steps (download shell script, chmod a+x, put on your PATH, run once to automatically download all dependent JARs).

2. Automatically download project dependencies from Clojars and Maven Central repositories to ~/.m2/repository/.

3. Same length command to type (= (count "lein") (count "boot")).

4. Both launch a shell script that starts a JVM with a Clojure instance and a set of build tooling libraries.

5. Both provide command line help for toplevel tasks and subtasks and allow running one or more tasks with a single one-line command.

6. Both construct the build environment from settings in a toplevel profile file (~/.lein/profiles.clj or ~/.profile.boot) and a per-project build config file (project.clj or build.boot).

7. Both provide a means of adding new tasks to the system (Leiningen's plugins and Boot's custom tasks).


Differences between Leiningen and Boot:

1a. Leiningen's ~/.lein/profiles.clj and project.clj files contain an EDN map with key-value pairs that specify various build and runtime settings for leiningen's tasks and subtasks (including plugins).

1b. Boot's ~/.profile.boot and build.boot files contain Clojure programs evaluated in the context of the boot.user namespace, which provides a series of functions and macros for setting environment variables, establishing default task parameters, and defining custom tasks by either composing existing tasks or writing your own custom functions. Task composition is performed by nesting fileset handlers in much the same way as Ring request/response handlers are nested (i.e., a middleware-based approach).

2a. For Leiningen tasks, all settings must generally be specified in the EDN map prior to running the command at the prompt.

2b. For Boot tasks, any settings may be specified directly on the command line and those omitted will be drawn from the values established in ~/.profile.boot and build.boot. This enables rapidly changing or overriding settings from the prompt without intermediate file editing.

3a. Leiningen tasks are run through a command line interface only.

3b. Boot tasks may be run through a command line interface, a REPL, or a build script. For those interested in developing their own build tasks, this enables a workflow in which you first write and test your build functions at the REPL, then save them to a build file, and finally run them from the command line.

4a. Leiningen - being the older, more mature platform - has a great many plugins and templates available for users to automate a wide variety of development-related tasks.

4b. Boot - being the newcomer on the scene - has a small but useful selection of community-provided plugins (see the Boot wiki) and no templates as of yet. Instead, it provides an accessible task development language and a number of patterns (on the wiki) to use when trying to replicate missing Leiningen features (aliases, injections, profiles, etc).


I hope this was a fairly clear and unbiased description of the two systems as they stand at the moment. As a disclaimer, I personally use both right now but am trying to incorporate boot more into my development workflow.

Happy hacking,
~Gary

Ivan L

unread,
Jan 22, 2015, 12:23:04 PM1/22/15
to clojur...@googlegroups.com
Boot looks amazing but does not have windows fully operating yet. This is unfortunate since it rules out a lot of corp dev environments.

pand...@gmail.com

unread,
Jan 22, 2015, 3:24:38 PM1/22/15
to clojur...@googlegroups.com
> Slightly off-topic: for people who are just beginning with ClojureScript, would you recommend using Leiningen or Boot, and why? (As I understand it, Boot is easier from the setup standpoint, but Leiningen has a longer track record / larger "infrastructure")

Since they're both free, why not try both?

My perspective is that while lein seems more about hiding ("automating") the complexity ("hair flammability") of building Clojure/Script projects (and it does a fantastic job of it, much of the time), boot is more about exposing lower-level tasks to "build" that process in the way you find best.

Like Gary, I use both.

J David Eisenberg

unread,
Jan 23, 2015, 9:26:05 AM1/23/15
to clojur...@googlegroups.com
Thanks for the information. For my particular project, things have to work on the widest variety of systems. Ivan L's comment that boot on Windows isn't fully operating yet leads me to conclude that I'll stay with Leiningen for the moment.

Reply all
Reply to author
Forward
0 new messages