Selasa, 18 September 2012

tcs-ruby: faster ruby for windows

As a rails developer using windows as my development machine I often getting annoyed on how much time needed to start things especially tests.
In case you're wondering why did I use windows instead of other OS-es better suited for ruby like MacOSX/linux it's because I'm comfortable with it and if you're disagree then feel free to stop reading at this point :)

Several days ago I found about this fork of ruby by TheCodeShop which will speed up things quiet significantly, I decided to try it and one of my project unit tests which needed around 45 sec to complete reduced to less than 20 sec.


This step assume you're using Win7 with pik to manage multiple ruby installation, if you don't have pik yet get it from https://github.com/vertiginous/pik

  1. Download one of ruby build from:
    (I'm using winio one)
  2. Extract it, for example to C:\Ruby-tcs193
  3. Modify Path to use ruby-tcs: go to Control Panel, System, Advanced System Settings, Environment Variables
  4. Edit Path in User variables, modify existing Ruby bin path to ruby-tcs bin (C:\Ruby-tcs193)
  5. Add new variable RUBYOPT with value: "-rfenix/replace"
  6. Next, add it to pik (you can stop here if you didn't use pik, but I recommend it in case you need to switch to standard ruby)
  7. open cmd, then enter "pik add [path to ruby-tcs bin]" for example "pik add C:\Ruby-tcs193\bin"
  8. Lastly install devkit for it, run "ruby c:\devkit\dk.rb init" then "ruby c:\devkit\dk.rb install"
  9. Done :)

Known problems

Heroku commands

heroku commands will raise error because of non existing fenix/replace, to fix simply remove RUBYOPT temporarily by entering "set RUBYOPT="

Standard ruby

same as above because standard ruby didn't use fenix so remove RUBYOPT temporarily