Ruby In Steel 1

Back to -Tutorials -Sapphire (Ruby In Steel) Tutorials -Archives -Ruby In Steel 1

Ruby In Steel 1.5 Build Configurations

How to switch between build, run and debug targets with ease

With Ruby In Steel 1.5 you can load, edit and run a single project with multiple versions of Ruby including Ruby (MRI) 1.8.x, 1.9.x and JRuby 1.4. Moreover there are two integrated debuggers which can be used with Ruby 1.8.x and JRuby 1.4. By setting up named ‘Build Configurations’ you can quickly switch from one ‘run’ or ‘debug’ target to another just by making a selection from a combo box.

For example, let’s assume that you want to target Ruby 1.8.6 but you also test against JRuby and Ruby 1.9.1. To do this you would create three named configurations - ‘Ruby18’, ‘Ruby19’ and ‘JRuby’. You can now run your project with each interpreter simply by selecting its configuration name from the Visual Studio toolbar. Each time you run the project you will be able to interact with it in the docked ‘Ruby console’. When you want to debug your code, you may use either of Ruby In Steel’s integrated debuggers - Cylon for Ruby 1.8.x or JCylon for JRuby.

Here is a short guide on how to create and use named Build Configurations.

How To Create Named Build Configurations

From the Solution Configuration drop-down in the Visual Studio toolbar, choose ‘Configuration Manager’:

If there are multiple projects open, select one of them and, in the Configuration column, select New:

Here I am going to create a Solution Configuration which, when selected, will apply the settings to one or more projects in the solution so I am leaving ‘Create new solution configurations’ checked. I name the Build ‘Ruby18’. To start off with a set of default settings, select an existing Build name in the ‘Copy Settings from’ drop-down then click OK. I go through the same process to create two more configurations which I call ‘Ruby19’ and ‘JRuby’:


Hint: To create global defaults - which will be applied to your future Ruby In Steel projects, load Tools, Options, Projects and Solutions, Ruby In Steel. Any changes made here - for example, to the location of the Ruby interpreter - will be applied as the default to all future projects. If you wish to override these defaults for a specific project you may do so by setting Project Properties as explained in this tutorial.

Customize Build Settings

Now that I have three named Build Configurations, I need to change a few of their settings. To do that, I select the Project, Properties menu item. This displays two pages (General and Build) of properties. The General page contains items that are not Build-dependent (that is, they apply to all Builds). I select the Build page.

From the Properties Configuration drop-down I select my ‘Ruby18’ configuration:

The properties page currently displays all my global defaults including the Ruby 1.8.6 interpreter. That is exactly what I want for this configuration so I make no changes.

I now select the ‘Ruby19’ configuration. For this configuration, I need to change the Ruby Interpreter property to point to the Ruby 1.9.1 interpreter. I do this by clicking the ‘Browse’ [...] button to browse to the Ruby 1.9 version of ruby.exe:

Finally, I want to set up my ‘JRuby’ configuration. To do this I simply change the Ruby Type property to JRuby (when this is done, the ‘Ruby Interpreter’ setting is ignored):

Select File, Save All. And now you are ready to run your application using three different Ruby interpreters. Switch to the Ruby source code file to be executed. Now we can test out the configurations. Here I’ve written a small program to verify the Ruby version and platform and to print some details of JRuby if the Java environment is detected. First I try it out with my Ruby18 configuration:

Now with Ruby19 :

And finally with JRuby:

I can debug using either the Cylon or JCylon debuggers for Ruby 1.8.x and JRuby 1.4. Here, as the JRuby configuration has been activated, the JCylon debugger is auto-selected:

Note: You may download the All-in-One installer for Ruby 1.9.1 (which includes a copy of my Ruby eBook, The Book Of Ruby, from RubyForge. JRuby can be downloaded from

Bookmark and Share   Keywords:  JRuby  Ruby In Steel DE 1  tutorial
© SapphireSteel Software 2014