The Almost Unbearable Lightness of LightTable

Note: This post is in Draft, I’ll be updating it a bit more…

LightTableSeesawAs I’ve been tweeting, I’m very interested in LightTable, the amazingly cool IDE being developed by Chris Granger @ibdknox and his gang. It’s a bit like the black spaceship from Hitch-Hikers Guide To The Galaxy though: “It’s the weird colour scheme that freaks me. Every time you try to operate one of these weird black controls, which are labeled in black on a black background, a small black light lights up black to let you know you’ve done it”. The next major release (in a month or so) will be addressing “user experience”, but in the mean time, what if you want to give it a serious try?

That is what the rest of this post is going to try and help you do also – get LightTable up and running so you can incorporate other projects and frameworks, which is really needed if you’re to proceed beyond trivial playing with it. But first, a warning from our sponsors (that’s me :). The version on LightTable says it all – 0.2.7. If you want a seamless install / development experience, especially if you have other installations of Clojure, IDE’s, lein, … then it’s probably best to come back later… They’re working quickly to address things, but this is a Real Agile Project that released very early and is now releasing often, so major kudos to them for doing so!

Finally, for some context, I’d rate myself as an “Enthusiastic Clojure Amateur” – I don’t do it for a day job, but I know my way around Unix, Maven, (now) Lein and Clojure through other environments. If you’re at this level or above then this post could be for you, and hopefully save you some time and frustration. You should also note that I use a Mac (is there any other platform to use for serious development? ;) so these instructions assume that. I won’t be doing a Windows post of this, but if anyone wants to then feel free to copy and change what I’ve written.

There are 3 key activities for setting up the latest version (0.2.7 or above) of Clojure:

  1. Clean Installation of Lein2
  2. Clean Installation of LightTable
  3. Creating a LightTable Project with Dependencies using Lein2

Note: I’m assuming you’ve got Maven 2 running, because you’re some sort of Java dev – I may add instructions for this later…

I’m sure all of these issues will be addressed in subsequent releases, but for the meantime, here’s how I did it – Note: it’s assumed that you’ve installed to your local user. If this is global (Unix) or Windows you’ll have to use different paths.

1. Clean Installation of Lein2

LeiningenThis was probably the most difficult and time-consuming thing to work out as I was running a version of Lein 1 that I’d installed ages ago, which is an absolute no-no. LightTable won’t work with this configuration and give you all sorts of weird errors. Whatever version of Lein you’re running it’s probably best to clean out your Maven directory:

rm -r ~/.m2/*

If you’re running an “old version” 1.x of Lein you’ll have to upgrade, which means that you should clean out your .lein directory:

rm -r ~/.lein

Then you’ll have to do a “Bootstrap Install” of Lein2 which isn’t that hard. Firstly, remove you’re old shellscript which in my case was in my ~/bin directory that is on my Unix path:

rm ~/bin/lein

Github LeiningenThen you’ll need to get the latest and greatest version of Lein 2.0.0 – this matters, as the default when you grab it from GitHub is the 2.1-SNAPSHOT (at this time of writing) version which is on the “master” branch, but unfortunately this won’t currently work with LightTable and give you weird connection errors. I originally got this, then changed it to Stable (2.0). In my environment, everything is in ~/Gits.

The final step for this is to then install Lein2:

cd ~/Gits/leiningen
lein install
lein version
>> Leiningen 2.0.0 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM

2. Clean Installation of LightTableLightTableIcon

Once you have the right version of Lein2 going, it’s actually pretty easy to get LightTable going either if you haven’t installed it or are running an earlier version. To reset your configuration, just remove your .lighttable directory and contents:

rm -r ~/.lighttable

If you don’t have a recent version of LightTable, i.e. your icon doesn’t look like the above one, then you’ll need the latest installation of LightTable, which is pretty easy – just go to http://www.lighttable.com and download the correct launcher

Once you’ve reset your configuration, just run LightTable, it should then get the latest version and tell you to restart. When you’ve done this you can check the version from the “command line” at the bottom by typing “version” which should show 0.2.7 or whatever the latest (higher) version is. If it’s less then somethings gone wrong – Maybe you didn’t delete the entire directory? Maybe you have an old version of the launcher? You’ll have to do some digging if this is the case…

3. Creating a LightTable Project with Dependencies using Lein2

Now you have the right infrastructure set up, it gets very easy. To create a new project, you just create a default template:

cd ~/Projects/LightTable/
lein new guitesting

start up LightTable and connect to your project

lighttable-connect

during which you’ll see connecting and retrieving messages

lighttable-retrieving

and hopefully a brief connected message

lighttable-connected

If you get any blue error windows popping up on the left, then something has gone wrong, probably with your installation of Lein2 so you should go through and check the above process again.

Ah, but there is “one more thing”, which was the key capability I was looking for originally with LightTable, and that’s the ability to include extra projects / dependencies. Now that you’re up and running, this should be comparatively easy. You just add whatever you want to your project.clj, probably using LightTable now you have it running

(defproject guitesting "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [seesaw "1.4.0"]])

which in my case was seesaw that is a development framework for Swing GUI’s that I talked about in my previous post on Easy UI development in Clojure with Seesaw. If you have an instance of LightTable running then you should quit and re-start it to pick up the new dependencies when you connect and that’s it! You should now be able to use LightTable like you see on all the latest articles and videos

Finally, I will be doing an “Unbearable Lightness of LightTable” when LightTable progresses more in installation to the stage where the above instructions will not be necessary. In the mean time, I hope the above has helped you if like me, you’ve been looking at all the latest LightTable videos and wondering why you can’t do these things.

PS If I you have a different experience then please let me know via the comments and I’ll correct or add to the post

About these ads

About changearc

Architectural & Process Change Agent on All Levels Currently Learning: Clojure and Kanban More info? http://www.linkedin.com/in/rwest
This entry was posted in Agile, Artificial Intelligence, Clojure, Coding and tagged , , , , , . Bookmark the permalink.

4 Responses to The Almost Unbearable Lightness of LightTable

  1. rjb says:

    Nice post! I took a slightly different path by using homebrew to pull down clojure and leiningen. One of the nice things about homebrew is that you can easily switch versions without having to manually clone, download, clean stuff, etc.

    > “In the mean time, I hope the above has helped you if like me, you’ve been looking at all the latest LightTable videos and wondering why you can’t do these things.”

    I’m still wondering why I can’t do those things that Chris shows, i.e. click on symbols to get documentation, finding out what is in different namespaces, multiple editors with single functions in them, etc. It appears that the version in his video is different than the latest version 0.2.7.

    • changearc says:

      Thanks Rod, I’ll definitely check out homebrew, so many package managers… Chris has indicated that the major release (0.3) will be in about a month that will address “usability”, so hopefully those extras will be there. In the mean time I’m looking forward to playing around with some more complex code :-)

  2. Robert Grant says:

    I don’t know if things have changed, but I’m running lein 2.3.4 and LightTable 0.6.5 and if I navigate to the Connections menu option, hit Clojure and find my new project.clj, it just sits there doing nothing; no feedback at all. Any ideas? :)

    • changearc says:

      Hi Robert,

      Apologies for the late reply. I just tried this and got the same result, but it’s not the way I work with Clojure projects on LT. I create a new project using ‘lein new test’ then in LT got to View/Workspace then right-click, select ‘Add folder’ and navigate to my lein project folder and select it. You should be good to go!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s