Step By Step Instructions for Installing Ruby, Cucumber & PhantomJS for Windows
These instructions are intended for following a tutorial about Cucumber. The tutorial can be found here:
- Part I: http://blog.codecentric.de/en/2013/08/cucumber-setup-basics/
- Part II: http://blog.codecentric.de/en/2013/08/cucumber-capybara-poltergeist/
You should have some version of git installed. Personally, I prefer Git Bash from http://msysgit.github.io/.
To install ruby, go to http://www.rubyinstaller.org/downloads/ and download the latest 1.9 or 2.0 Ruby installer. At the time of writing, this is Ruby 1.9.3-p448 along or Ruby 2.0.0-p247 with the matching DevKit (see "Which Development Kit?" on the ruby installer page, for the aforementioned Ruby 1.9.3-p448 it would be DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe, for Ruby 2.0.0-p247 it would be DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe).
Ruby 2.0 is also stable already, but it seems that one native gem dependency of Cucumber (Nokogiri) has not yet been build for Ruby 2.0. I recently updated the Gemfile.lock file in the example project and tested it successfully with Ruby 2.0.
Execute the Ruby installer. We do not need Tcl/Tk support, but you should let the installer add Ruby to your PATH. Follow the instructions at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit to install the DevKit.
Now we will install the bundler gem. A gem is a packaged ruby application or library. It can be installed with the gem command that comes with ruby, like this:
gem install bundler. Bundler is a dependency manager which is built on top of the gems package system. So from now we will not install gems directly but let bundler do the work, which also automatically takes care of transitive dependencies.
Now, all ruby gems that are required to run Cucumber can be installed simply by typing
bundle install in the top directory of the example project. If you have not done so yet, clone this repo right now by doing
git clone -b 00_setup https://github.com/basti1302/audiobook-collection-manager-acceptance.git, open a command prompt and
cd to it. The file
Gemfile contains the information which gems are to be installed.
bundle install will install Cucumber with all its dependencies (and their transitive dependencies). Check that it's installed correctly with
cucucmber --version (This tutorial uses 1.3.5).
Last but not the least we install PhantomJS. Go to http://phantomjs.org/download.html and fetch the zip file for Windows. Extract it to a location of your choice and add it to your Windows PATH.
Check that it is working with
phantomjs --version (This tutorial uses 1.9.1, also tested with 1.9.2).
One more (optional) thing: Cucumber makes heavy use of coloured output on the console. You need ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows. After downloading and extracting, you should add the relevant directory to your PATH (see the contained readme.txt) and then run ansicon.exe -i once to make sure colour support is loaded each time you start a command prompt.