update 2009-10-21: This post is a writeup of my early experiences with gemcutter and rubygems. The strange runtime error I did not understand was probably related to that I needed to update rubygems to 1.3.5. I now know how to use gemcutter from ruby1.8.6 using the oneclick installer .
I have been using jspec on macosx for a while and decided to give it a try on windows vista today. Installing jspec on macosx and linux can be done using the instructions here .
I want to run the automated jspec tests available via rhino at a client site. Sadly , I am forced to use windows there, so I have given some thought on how to make jspec run on windows.
First of all you need to install ruby. I used the automated 1.8.6 One-Click Installer available here . After installing i ran
gem update
the instructions in the README file for jspec currently states that I should install gemcutter and install jspec via that . I was not able to do that on windows ( my system decided to report an obscure runtime error that I did not understand). So i decided to do this instead:
gem sources -a http://gems.github.com
gem install visionmedia-jspec
I let gem install the required dependencies visionmedia-commander and visionmedia-bind. After this I had the jspec script available. Sadly this gave me version 2.7.2 (I noticed \ruby\lib\ruby\gems\1.8\gems\visionmedia-jspec-2.7.2 ) The listing on gemcutter told me that a version 2.11.10 is a avaiable , so I decided to dig deeper. Maybe I could make gemcutter work anyway?
After a little browsing on github.com I found the oneclick installer
I cloned this repo using git
using the following command:
git clone git://github.com/oneclick/rubyinstaller.git
and pressed
rake ruby19
This project creates a sandbox that compiles a working ruby environment using mingw.
After contemplating the insanity of what I was doing for a couple of minutes (remember : installing a working ruby on linux is a single shell command) I grabbed some coca cola and started browsing through the source code for ruby distro while the rubyinstall was compiling. I looked a bit at ruby.c and vm_exec.c and had grim flashbacks to my c days. Luckily the compile finished and I copied ruby19_mingw to my c:\ drive and set it up on my PATH variable. Then I could check which version I was using:
C:\>ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
Now I was able to do:
gem install gemcutter
gem tumble
gem install jspec
(Note that there is information sent to the terminal during these steps)
Now for the interesting part(!) jspec was working , so I could do this:
jspec init SolitaireCipher --freeze
This created a directory where I can train doing the SolitaireCipher using javascript. I renamed lib/yourlib.core.js to lib/SolitaireCipher.js and spec/spec.core.js to spec/spec.SolitaireCipher.js and spec/spec.dom.html accordingly.
After 20 mins of fiddling I managed to get some running tests in a browser by opening spec.dom.html. Then I decided I want to automate the tests using mozilla rhino. After installing rhino , I could run automated tests like this
cd c:\projects\SolitaireCipher
jspec --rhino
This opens up a proces that listens to file changes in the lib and spec folders. All very well – untill I discovered that jspec currently uses ANSI codes to render colors to the terminal screens. ANSI codes are not supported on windows vista (something with ANSI.SYS being obsoleted), so if I want the nice colors then I need an alternative terminal than my command prompt in vista.
I found rxvt available from PortableGit on google code. This renders the colors just nicely – but has some other drawbacks. If I just use rxvt for rendering feedback from the jspec tests, then it seems to work though.
One thing to note is that rhino needs the java sdk to be installed and js.jar needs to be on your CLASSPATH. when starting jspec from rxvt on the msys from PortableGit, then CLASSPATH could be set like this (assuming rhino is installed in c:\tools ):
export CLASSPATH=/c/tools/rhino1_7R2/js.jar
I probably want to avoid using rxvt on PortableGit too much . There are some major flaws listed here .
Maybe I should look into doing a adobe air frontend for jspec?

