Install cc.rb as NT Service

People said the easiest way to install cc.rb as a NT Service is using cygwin.

My problem is still multiple ruby env. The trick is to set the correct GEM_HOME.

cygwin is the tool/simulate env to use windows as linux, package management is very handy.

It seems jruby is having problems to get the correct child status return code, even a simple echo it reported $! as 256 while in pure cygwin env it’s zero.

I had to install another ruby env in cygwin, which is very joyful in cygwin.

Druing this investigation period, rspec has been upgraded from 1.3 to 2.2, then 2.3, I have no time/interest to change my spec code yet, fortuantely I found the way to use gem to get previous version:

gem install rspec -v 1.3

Install json needs make and gcc, re-run setup for cygwin, get it as needed.

Try ‘ruby cruise start’ in cygwin command line first, got lots of openpath path too long warning. Don’t know why and how to sovle it. Build passed anyway, ignore it for now.

Then add NT Service using cygrunsrv, note the different path in args, otherwise got can’t load build_start problem when cc.rb trying to start.

cygrunsrv –install CruiseControl.rb –path ‘/usr/bin/ruby.exe’ –args ‘/cygdrive/d/app/cruisecontrol-1.4.0/cruise start’ –chdir ‘d:/app/cruisecontrol-1.4.0’  –env GEM_HOME=”/lib/ruby/gems” -u Mao –passwd youknow

Setting user/pswd is to ensure cruise_data path is not pointing to /home/SYSYEM folder.