0
-h1. Using Cucumber with
Java0
+h1. Using Cucumber with
C#0
-This directory contains code to demonstrate how Cucumber can be used to develop Java code.
0
-You need JRuby 1.1.3 or higher installed and JRuby's bin directory on your PATH.
0
+This directory contains code to demonstrate how Cucumber can be used to develop C# code.
0
+You need both IronRuby and MRI (Matz Ruby Interpreter).
0
+You'll need MRI to build IronRuby. You also need MRI to install gems since IronRuby can
0
+not install its own gems yet (although it can use them). When you have installed IronRuby you
0
+can use gems installed into MRI from IronRuby.
0
+Just download the latest Ruby One click installer from RubyForge and run it with the defaults.
0
+When you open a new command prompt you should be able to run:
0
+<pre>ruby --version</pre>
0
+<pre>rake --version</pre>
0
+h2. Installing IronRuby
0
+With MRI installed we can install IronRuby. At the time of this writing there is no installer
0
+for IronRuby, so you have to download the IronRuby sources from the Subversion repository and build
0
+If you don't have Subversion installed, install the Subversion command line toolset (or TortoiseSvn
0
+if you have command line fobia).
0
+h3. Get IronRuby sources
0
+<pre>svn checkout http://ironruby.rubyforge.org/svn/trunk ironruby
0
+Note: *checkout* means "pull down a copy of the sources to my local machine". It's not the same
0
+as checkout in TFS or Visual SourceSafe (which I truly hope you have moved past).
0
+Open a Visual Studio command prompt and cd to where you downloaded the IronRuby sources. Build it:
0
+<code>rake build</code>
0
+When you have completed this step you should be able to run
0
+<code>build\debug\ir.exe <code>
0
+This should give you a new prompt (Interactive IronRuby shell). Just type <code>exit</code>
0
+and hit enter. You have installed IronRuby!
0
+You can now close your Visual Studio command prompt. From here on a regular command prompt
0
h2. Installing required gems
0
-jruby -S gem install aslakhellesoy-cucumber
0
-jruby -S gem install diff-lcs
0
+Since IronRuby doesn't yet know how to install gems you have to install them using MRI:
0
+<pre>gem install cucumber
0
+h2. Creating a cucumber wrapper script for IronRuby
0
-h2. Running the scenarios
0
+When Cucumber is installed, a cucumber.bat script is placed under your MRI's bin directory.
0
+This script will run cucumber with MRI. We'll make a similar one that will launch Cucumber
0
-Open a shell in this directory (java) and execute the following command:
0
+Create an empty file called <code>icucumber.bat</code> in MRI's bin directory.
0
+Open it in your favourite text editor (I hope you have installed something better than
0
+Notepad, but it will do).
0
+On my system icucumber.bat looks like this (You may have to change the paths).
0
+REM This is to tell IronRuby where to find gems.
0
+SET GEM_PATH=%~dp0..\lib\ruby\gems\1.8
0
+@"C:\scm\ironruby\build\debug\ir.exe" "%~dp0cucumber" %*
0
-This will compile the java code and package it in a jar file, and then run Cucumber against
0
+Tip: <code>%~dp0</code> evaluates to "current script's directory with trailing backslash" in case
0
+you're wondering what this is.
0
+Now you should be able to run Cucumber:
0
+<code>icucumber --help<code>
0
+h2. Running the Cucumber C# example
0
+Open a command prompt and cd to the Cucumber examples directory for C#. If you have installed MRI to the default
0
+location you'll find them under <code>C:\ruby\lib\ruby\gems\1.8\gems\cucumber-X.Y.Z\examples</code>
0
+(Replace <code>X.Y.Z</code> with the Cucumber version you installed above)
0
+h3. Run the plain ruby example
0
-There is a deliberate error. See if you can fix it!
0
+There is a deliberate error in the C# code. See if you can fix it!