Thursday, 19 November 2009

Running IronRuby 0.9.2 with RubyMine 2.0

Latest releases of IronRuby 0.9.2 and RubyMine 2.0 inspired me to make them play together. That's my first experience of running IronRuby in fully featured IDE so I was rather doubtful whether it will work or not.

Here goes step-by-step manual:

1. Download IronRuby 0.9.2 from here and install it.
2. Download RubyMine 2.0 from here and install it. You may need a licence - grab it here.
3. Run RubyMine
4. Click Project Settings or press Ctrl + Alt + S:

5. Navigate to 'Ruby SDK and Gems' left menu option:

6. Click 'Add SDK...' button:

7. Choose ir.exe in your IronRuby 0.9.2 installation folder:

8. That's it! We have IronRuby listed as Ruby SDK in RubyMine:

9. Let's try it in action! Close this window and create a new project:

10. Choose project location and 'Empty project' option - we don't need Rails at the moment:

11. Create a folder named 'src' and add a 'main.rb' file to it:

12. Write this code to editor (and feel the power of RubyMine's IntelliSense):

13. Click the arrow button and choose 'Edit Configurations' option:

14. Add new Ruby configuration:

15. Name configuration and select our 'main.rb' file as executable script:

16. It's damn important to clear 'Ruby Arguments' field. Change this:

to this:

otherwise you'll get the 'can't convert NilClass into String (TypeError)' error:

17. Press OK and run our first program:

18. Here we go, our first IronRuby program running in RubyMine:

Isn't it wonderful? :)

1 comment:

DJL said...

Thanks. Works on IronRuby 1.0 RC1 too.