DRbProxy

Why? I am using JRuby for my development because I need to access some Java libraries. That said, every time I run tests is going to take forever as I need to start a JVM and Rails environment initialization. Even with the help on Nailgun, it is still very slow. DRbProxy allows me to interact JRuby classes with Ruby.

How? Let’s say I want to use my GData JRuby client library from Ruby:

  1. I create a file called ‘libs.rb’ with the following content:

gem 'gdata-jruby-client'
require 'gdata_jruby_client'
  1. I start the drbproxy server

jruby drbproxy -f libs.rb
  1. Define GData class in Ruby/IRb:

require 'drbproxy'
class GData < DRbProxy::DRbProxyClass; end
  1. Now I can do things like:

puts GData::CalendarService::OWN_CALENDAR_URL
=> "http://www.google.com/calendar/feeds/default/owncalendars/full"