jRuby and Matz's Ruby on the same machine?
Is it possible to run jRuby and native ruby on the same machine?
For example installing rake or gem under both it find's Matz Ruby extensions /usr/bin/g开发者_JAVA技巧em
or /usr/bin/rake
The MRI gems and jruby gems are mixed up.
Is there any experience in that constellation?
Take a look at RVM (Ruby Version Manager), which
...is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.
rvm on Unix and pik on Windows are the most typical ways to handle multiple ruby versions on the same machine.
But it can be done without any external tools easily too. Just install JRuby in any location you want and add JRuby's bin directory to your PATH. I typically add jruby at the end of the PATH, so that when I type gem or rake, C-Ruby is used, and when I want to use jruby I type:
jruby -S gem -- to run gem with JRuby
jruby -S rake -- to run rake with JRuby
jruby -S spec -- to run rspec with JRuby
Alternatively, you could use jgem, jrake launcher scripts or aliases, if that's easier to type.
精彩评论