In order to get JRuby and script/autospec to work with in a Rails app you need to do a bit of hacking on your own. The basic problem is the autospec script attempts to call the autotest executable located in /usr/bin or /usr/local/bin from the command line through a system call. That script by default uses the ruby and not the jruby executable within your local environment. This will obviously fail. Instead I went ahead and copied the contents of the autotest script into script/autospec so everything runs nice and smooth with a jruby environment. Here is my script:
#!/usr/bin/env jruby
gem ‘test-unit’, ‘1.2.3’ if RUBY_VERSION.to_f >= 1.9
ENV[‘RSPEC’] = ‘true’ # allows autotest to discover rspec
ENV[‘AUTOTEST’] = ‘true’ # allows autotest to run w/ color on linux
require ‘rubygems’
version = “>= 0”
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem ‘ZenTest’, version
load Gem.bin_path(‘ZenTest’, ‘autotest’, version)
Now simply run ./script/autospec while you develop and autotest will work as it did before. Make sure you have the ZenTest and autotest-rails gems installed into your JRuby environment (using jgem).
Code Complete #2: JRuby with Charles Nutter
We discuss the origins of JRuby, JRuby on Android/AppEngine and how to run your Ruby/Rails project on Java with JRuby.
Charles is one of the lead developers of JRuby and now is hacking away at Engine Yard.
The intro and outro music of this podcast is from an internet archive backup of Why the Lucky Stiff’s performance at the very first RailsConf from June 2006.
Follow Charles on Twitter and his blog.
I snuck into the conservative’s conference while at Netroots Nation. A lot of the conversation focuses on the audience’s love of DDT (yes the chemical).
Howard Dean’s Prescription for Real Healthcare Reform for the iPhone
Finally released. Developed by me.
pressflip (i made this)
github (i write code you can see)
twitter (i say things in less than 140 characters)