torsdag, april 05, 2007

Mongrel in JRuby

As I have told you before, we have been working on getting Mongrel working in JRuby off and on for a long while. One or two months ago, I got the Ragel definition ported correctly and the rest working. The plan is to cooperate with Zed and create a JRuby-native Mongrel gem out there, but until then I will describe the steps you need to take to get this working for yourself.

First of all, you need to install gem_plugin. The easiest way is to use gem:
jem install -y gem_plugin --no-rdoc --no-ri
After this is done, you can either download Mongrel-support from svn://, and build the extension manually, or you can download it directly here: If you decide to build it yourself, you first need a current version of JRuby from trunk. Check out mongrel-support from the Subversion repository and execute these commands:
cp $JRUBY_HOME/lib/jruby.jar lib
ant jar
After that you will have a http11.jar-file in lib. Regardless of how you get the http11.jar-file, place it in $JRUBY_HOME/lib/ruby/site_ruby/1.8/. Then you can proceed in a few different ways. You could copy the Mongrel-files from your MRI installation, or you could download Mongrel from version control. Regardless of how, you need to copy mongrel.rb, mutex_fix.rb and the mongrel-directory from Mongrel into $JRUBY_HOME/lib/ruby/site_ruby/1.8/. You can also copy bin/mongrel_rails into $JRUBY_HOME/bin and change the shebang to point to /usr/bin/env jruby. After this, you are good to go with JRuby and Mongrel.

1 kommentar:

Raphaël Valyi sa...

Hi Ola,

This worked for me. Still, I also had to do that:
* rename into (whit appropriates values) so that ant can compile
* and I also had to gem install etc and cgi_multipart_eof_fix.

I'm now having fun testing all that...


Raphaël Valyi