02MayUsing IronRuby with RubyMine

RubyMine was released earlier this week. I’ve used rubymine in the past and was very impressed with the IDE, so much that I’m silently hoping the guys from Jetbrains would do a C# IDE too. I’d probably buy that one as well, but for now I’ll settle for Resharper with Visual studio.

By default Rubymine won’t accept IronRuby as a ruby SDK, but I asked for help in the twitterverse and got it (http://twitter.com/iRomeo/statuses/1677867948).

settings_rubymine

Just symlinking didn’t really work because the ruby.exe listens to –version for getting its version number.  IronRuby on the other hand listens to –v to get its version number.  The solution to that is to create a batch file that will translate the –version  modifier to –v.

So instead of symlinking the ir.exe to a name that starts with ruby I created a batch file called ruby_iron.cmd with the following content.

@echo off
set IR_CMD="%~dp0ir.exe"
if "%1"=="--version" ( GOTO RUBY_VERSION )
GOTO RUBY
:RUBY_VERSION
%IR_CMD% -v
goto QUIT
:RUBY
%IR_CMD%
:QUIT

With that ruby_iron.cmd file in place you can just add IronRuby as an SDK in RubyMine.

Enjoy :)


  1. 1 Roman Chenyatchik02 May 2009

    Ivan,
    Thank you for detailed instructions. I posted link to this article in RubyMine forum – http://www.jetbrains.net/devnet/thread/281493?tstart=0

  2. 2 Roman Chenyatchik07 May 2009

    Ivan, I’ve noticed a bug in your script. You don’t populate original argument to ir.exe, should be

    %IRCMD% %*
    ..
    E.g thus on your screenshot RubyMine displays such huge and strange name for IronRuby sdk

  3. 3 Ryan Riley17 May 2009

    Thanks for posting this. I’m no expert on cmdlets, so I have a couple of questions. First, where do I put the file? Do I stick it in the same directory as ir.exe? Second, what does “%~dp0ir.exe” mean? Thanks!

  4. 4 Ryan Riley17 May 2009

    Also, how would you compare this with the Ruby in Steel VS add-in from Sapphire Steel? Looks like RubyMine would compete with the Developer edition, which is $200, less the refactor tools.

  5. 5 ivan17 May 2009

    Ryan,
    you should put the file in the same folder as ir.exe.
    %~dp0ir.exe means that it should expand the path it finds ir.exe in

    Rubymine would be a competitor to ruby in steel developer edition. I’ve got both but I tend to use rubymine more. I _love_ refactoring help you get from rubymine. Ruby In Steel only gives me ruby integration in visual studio but so far even their autocomplete hasn’t worked for me, nor has the debugging ever worked as i would have wanted it to.
    So currently my vote goes to Rubymine

  6. 6 Ryan Riley18 May 2009

    Thanks, Ivan. That is a great response, and I’m looking forward to using RubyMine for IronRuby development, as well as continuing to read your book. Great start in chapter 1, so far!

  7. 7 rifraf03 Aug 2009

    Seems to work ‘out of the box’ on IronRuby 0.9 though you need to set the startup options to ‘-e STDOUT.sync=true;STDERR.sync=true;load($0)’

  8. 8 angel13 Feb 2010

    Hi..I try it but I’ve a error when run my project….”can’t convert NilClass into String (TypeError)”…what am I do bad??..thanks!!

  1. 1 rubydoes.net » Blog Archive » Using IronRuby with RubyMine
  2. 2 progg.ru
    Trackback on May 4th, 2009 at 15:16

Recent Flickrs

    Blogroll

    Recent Listening

    Scrobbler