I spend most of my time in the terminal, but when a graphical text editor is useful I'm a fan of redcar. Early versions were a bit rough but the project has progressed nicely and the editor now appears to be quite stable. Redcar has always been solid in terms of syntax highlighting: out-of-the-box we find support for Ruby, Clojure, Scala and Haskell (!) and many others. The only slight hiccup is that redcar requires JRuby, and while I'm often using JRuby anyway it would be nice to have redcar accessible even when working with MRI or Rubinius.
It seems like rvm should be able to help us out here. We should be able to install redcar into it's own gemset and create a script that switches to JRuby with that gemset and starts up the editor. Any such script shouldn't interfere with the Ruby interpreter in use in the current shell. A dead simple approach doesn't get very far:
[@varese ~]$ more bin/redcar rvm use jruby-1.6.7@redcar redcar [@varese ~]$ bin/redcar RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal settings to allow shell login. Please visit https://rvm.io/workflow/screen/ for example. ...
Fortunately Wayne includes some excellent documentation about sourcing the necessary functions into your scripts in order to setup the environment as expected. A small change gives us the following:
A quick test verifies that we're up and running:
[@varese ~]$ which ruby ~/.rvm/rubies/ruby-1.9.3-p194/bin/ruby [@varese ~]$ bin/redcar Using /home/mersault/.rvm/gems/jruby-1.6.7 with gemset redcar Redcar 0.13 ( java ) ... [@varese ~]$ which ruby ~/.rvm/rubies/ruby-1.9.3-p194/bin/ruby