REPL bootstrap pimpage

May 2, 2013 § 4 Comments

The last couple of Clojure projects I’ve been on the team has invested a bit of time in pimping the REPL. Here are some of the things we’ve got happening when a custom bootstrap REPL namespace is loaded:

Dev of the day

Because it’s nice to make people feel special, show the dev of the day:

Screen Shot 2013-05-02 at 08.58.13

This can be pulled from GIT:

This code needs the command line tool figlet installed.

Print last few GIT commits.

Make the project feel alive with some recent commits

Screen Shot 2013-05-02 at 09.12.20

May as well show the GIT branch whilst you’re at it:

Architecture Diagrams

A dev on our team wanted to draw a picture. Rather than using something like Omnigraph he stuck to the principal of always using Emacs for everything, no matter how painful or irrational. So he fired up artist-mode and starting sketching. In one of our projects we’ve now got a nice ASCII sequence diagram explaining the flow to the wandering REPL dev. The ascii itself is stored as a txt file, slurped in and displayed upon bootstrap.

Random Stuff

We once had a sequence of project quotes stored in a namespace and the REPL displayed one of them using rand-nth. It’s a nice way to start the day being confronted with messages like ‘The Horror.. The Horror!’, or quotes from Macbeth, Forest Gump and various gangster movies. If you get sick of the same quotes then add a new one.

Since my current project is for a newspaper company we’ve got a random headline showing up. You could in theory sit down and read the news (a flavour of) by repeatedly recompiling the REPL namespace.

Other stuff:

  • If you’ve got a web-app, launch it.
  • Display what is running, ports etc.
  • Use stuff – (:use [clojure.pprint] [clojure.repl])
  • Config – show what’s in ZooKeeper or whatever.

Useful REPL functions: Our bootstrap code has a bunch of handy functions in for making life easier for the dev. For example pre-loaded queries against some data-store or helper functions for data-structures you’re always munging. We have a separate repl-helpers NS that contains them and we list the contents using ns-publics.

I’m interested in what other people/teams have done to make life more interesting in the REPL. What’s cool and fun?

What’s this?

You are currently reading REPL bootstrap pimpage at Pithering About.