hmans / rbfu

Minimal Ruby version management is minimal.
MIT License
118 stars 10 forks source link

Please enable Wiki for How-Tos #25

Closed lwe closed 12 years ago

lwe commented 12 years ago

Would be nice if you could enable the Wiki so users can add How-To articles or similar, thx. Of course there probably might not be many, but here's an actual example for a how-to I was looking for:

Recently I've run into the situation where I had to use jruby in 1.9 mode. To enable the 1.9 mode in jruby 1.6.x one has to provide the argument --1.9 to every call to ruby. So while switching to jruby works perfectly with rbfu, it might not be in the correct mode for the current project. Initially I thought it might be nice if there's support for this out of the box by rbfu, but on the other hand this is probably out of the scope of rbfu, because mode switching is vendor specific. Furthermore it can be easily done by using a wrapper script before calling the original jruby binary:

  1. install jruby using ruby-build or whatever: ruby-build jruby-1.6.7.2 ~/.rbfu/rubies/jruby-1.9-1.6.7.2
  2. rename jruby to _jruby-bin: cd ~/.rbfu/rubies/jruby-1.9-1.6.7.2/bin && mv jruby _jruby-bin
  3. create a wrapper script which sets the --1.9 option:
echo '#/bin/sh
_jruby-bin --1.9 "$@"' > ~/.rbfu/rubies/jruby-1.9-1.6.7.2/bin/jruby
chmod +x ~/.rbfu/rubies/jruby-1.9-1.6.7.2/bin/jruby

Tadaa, now when calling rbfu @jruby-1.9-1.6.7.2 ruby -v is automatically in 1.9 mode, also all commands like irb, gem etc. use the correct mode as well. A similar solution would work for rbx to enable 1.9 mode.

lwe commented 12 years ago

^^ uhm, just saw that there's a FAQ section in the README, would this be a useful addition?