Last week I posted about my dive into Limelight, a graphical user interface (GUI) that I’ll be using with my tic tac toe code. I mentioned that you’ll need to install JRuby and then the Limelight gem to check it out, but I glossed over what can be a somewhat tricky process- especially if you want to run the specs in the Limelight tutorial. Following is a more thorough walkthrough.

If you have RVM installed then you can head over to this previous post to get JRruby installed on your computer.

If you don’t have RVM installed or haven’t used it, do yourself a favor and block out 8 minutes to watch this solid intro video and get it set up. Then check out the aforementioned post to get JRuby installed.

RVM check? JRuby Check? Awesome. Now in terminal type 'rvm use jruby' (no quotes necessary for any of the commands in this post) to make sure you’re using JRuby. (You can also type 'rvm list' to see all available Rubies.)

Next up, type 'gem install limelight'. After Limelight has finished downloading and installing you can type 'limelight open' and you’ll be presented with the Limelight welcome screen, including a tutorial, documentation and sample apps.

(Note: if you get a "-bash: Limelight: command not found" error there’s a good chance you are not using JRuby and/or didn’t install the Limelight gem into the JRuby gemset. You can confirm this by typing 'rvm current' to check the Ruby you’re running and type 'gem list' to see what gems are available)

If you decide to check out the Limelight docs and do the sample app in the “Getting Started” section you’ll need to do one more important step. In order to run the specs in the sample app you need to use a 1.x version of Rspec (which is currently at version 2.10.0).

RVM to the rescue again. It makes it easy to have a different version of Rspec available by allowing you to create a separate gemset. You can do this on a per-project basis (and dive into the awesomeness of .rvmrc files), or you can also just make a gemset for playing around in Limelight. Here’s the steps on how to do that:

Confirm that you’re using JRuby by typing 'rvm list' or 'rvm current'.

Next, type 'rvm gemset create limelight_gems' (or whatever you want to name the gemset in place of limelight_gems). Then type 'rvm gemset use limelight_gems'.

Congrats! You know have a fresh gemset to work with. Be sure to 'gem install limelight' again, and then 'gem install rspec -v 1.2.9'. If you want to be sure that you’re using JRuby and the right gemset you can just type 'rvm current' and you should get something like "jruby-1.6.6@limelight_gems", where 1.6.6 is the version of JRuby you’re running.

Now, whenever you want to run Limelight specs (or you get to that point in the tutorial), you can type 'jruby -S spec spec' and you should be good to go. If you get the dreaded "jruby: No such file or directory -- spec (LoadError)" it’s most likely due to the fact you’re using a 2.x version of Rspec. It was a couple hours of seeing this message that lead to some serious frustration for me and the motivation to write this post. Now if I see that message a quick 'rvm use gemset limelight_gems' makes it all o.k. again.