Tag: hudson

Introduction

As some of you might know, around one year ago I’ve developed small (around 1k PHP and bash code lines) integration software, to test Rails based apps “outside” of my own computer. I hate to wait when CPU is around 100% and it slows down my dev environment. Moving tests (for example tests of whole application after bigger re-factoring) to a different machine is really convenient:

Don’t need to wait when developing

On a “non-gui” machine tests will probably run faster

Everything can be “clicked” via web interface so it is fast

Tests history and code coverage history available when needed

However my software had some disadvantages:

PHP based

Bad GUI (not working properly all the time)

No Ruby versions management

No gemsets (everything stored in one gemset per Ruby version)

No locks on applications – could start same tests more then one time simultaneously

Despite the disadvantages of this software it served me quite well. However I’ve decided to rewrite it to Rails to speed up development. I know about Hudson and other continuous integration servers, however I like to do stuff on my own when I can. That’s why I’ve decided to write my own small ruby integration server. I’ll be posting here tips and source codes so you can build your own dedicated server software. I am writing this at the same time as I create this software, so probably sometimes it will be inconsistent – sorry ;)

One Ruby to rule them all!

Ok – lets start! The basic purpose of this software is to test applications with different Ruby versions (REE, 1.9.2, 1.8.7, etc). But how to manage Rubies from Ruby? We need to (well maybe we don’t need to, but it is idea I came up with) create some bash scripts and then we will enclose them with Ruby code.

We need to be able to do following things with our Ruby code:

List Rubies

List available Rubies

Install Rubies

Uninstall Rubies

Listing RVM Rubies

We will be creating some bash scripts and then execute them from our application. Lets start from listing Rubies:

Why use tee instead of redirecting stream? Well I wanted to save output into a file but also I would like to be able to fetch it directly in Ruby. Of course this task can take a lot of time, so it will be ignited in background (how to do so – later ;) ). All the scripts parameters will come directly from application. We put a lock when we start to install and we will remove it after it’s done, so we will know when everything started and ended.