views:

110

answers:

3

For example, if I install Rails for regular Ruby, am I required to have a special install of Rails for JRuby? So that I have duplicates for everything?

A: 

If you bundle your gems with your Rails application, and this can include Rails itself, then there's no requirement to have multiple installs.

Some gems come in a variety of platform specific flavors, such as for JRuby or Win32, which may make this impractical if the application is run on a mixed platform environment. While Rails does not appear to be branched this way, many others, especially those that bind tightly to Ruby, such as compiled extensions, do.

It's worth trying to bundle as many gems as possible with your application and using a frozen version of Rails to see how it works out, and tweak it as required.

tadman
+3  A: 

The simple answer is yes. JRuby represents a separate installation of Ruby on your system so Gems must be installed on both JRuby and Ruby separately.

Josh Moore
A: 

Some gems use non-FFI C extensions. These will not work under JRuby.

Some gems install differently, depending on the platform (e.g. Mongrel). In which case separate installs are required.

You can install Ruby and JRuby side by side and then compare gems as follows:

gem list --local
jruby -S gem list --local
Rob