JRuby + Nailgun + Autotest
I attended JRubyConf a little over a week ago and got some inspiration. I decided to pick back up a JRuby app that I’ve been working on. Part of that process was to update and add a few gems. One being autotest (autotest-rails, autotest-growl, autotest-fsevent, to be exact). Like always, it just worked on JRuby. These little boosts of moral and motivation are always welcomed. After a few days, the JVM startup time starts to wear on you. I really don’t harp on that issue to much though, the flexibility, and options that JRuby gives you out weight the negatives, in my opinion anyway. Today I noticed a tweet by Joe Kutner (@codefinger) that referenced a blog post entitled "Fast Tests on JRuby (RSpec + Nailgun + Autotest). More motivation. Its a good article, but for me, it only got me part of the way. I kept getting an error when I would run the Nailgun client.
jruby: unknown option --ng
Thanks to Nick Sieger (@nicksieger) he pointed out that adding some options to your JRUBY_OPTS environment variable would help. His explanation was, “you might try setting JRUBY_OPTS=-Xlaunch.inproc=false; that will allow sub-JRubies to recognize —ng”. I also added the —1.9 option as well. I have the —1.9 option set in my .jrubyrc file, but for some reason that was not being respected. It very well could be an error on my part, maybe something isn’t sourced somewhere. I have all my options in my .profile file. I’ll investigate another day. Anyway, my exported JRUBY_OPTS looks like this.
export JRUBY_OPTS="--1.9 -Xlaunch.inproc=false"
Then run the Nailgun server, and client as outlined in the above mentioned blog post. Ahhh…JRuby, how I love thee.