I really love cruisecontrol.rb in a team environment.  The ability to run tests against every commit is great, and it is such fun being the “build police”.

Excuse me sir, can I see your license to commit please?

We can have some fun with that one.

This license expired just before the dotcom bubble

You have a languague restriction here that says you can commit only while wearing vb.net

I need to see some proof of build collision insurance.

But I digress. Sorry, back to the program.

As rails grows, I have some questions.

  1. Where the heck is code for cruise control?

  2. Can I use git?

  3. Will it run against rails 2.1 since I am security conscience and have updated after the recent warnings and threats?

Let’s do some research.  The code used to be at rubyforge. Looks like the code is still there. However, according to this post, they are moving to github. The link in that post has an extra *, but sure enough, you can find cruisecontrol.rb at http://github.com/thoughtworks/cruisecontrol.rb. Cool, now I know where to get it.

What about git support?  A google search, turns up benburkert’s github branch. Looks promising. Searching git hub for cruisecontrol.rb shows several forks, but these are all from rubyforge git.  I want it straight from thoughtworks.  Digging a little in the code shows it is already in the thoughtworks master.  There is even a mercurial adapter.  Let’s give it a try. Sure enough, it works just fine with

cruise add projectname -r file:///home/me/src/gitproject -s git


cruise help add

for all the options.

Great, 2 for 2.  Now what about support for Rails 2.1?  Unfortunately, it is not there. Cruisecontrol.rb currently runs with rails 1.2.3, and a simple version change in environment.rb doesn’t fix it. (Didn’t figure it would but I had to try it right?)  For all of us who have updated to ruby 1.8.7, we are stuck for now. Ruby 1.8.7 only runs rails 2.1. My last post about multiple version of ruby doesn’t really help either.

I did find this post answered by the team about porting cruisecontrol to merb. That sounds interesting indeed.

Until then, who is working on a rails 2.1 version of cruisecontrol.rb?

What is the best way to support multiple versions of ruby?

Some options:

  • Multiruby looks like it may do what I want. I already have it installed, because I am autotest-addicted (first coined by Dr Nic.

  • Michael Greenly posted this, which would work since I am running ubuntu.

  • A buddy recommended GNU Stow.

I chose to use stow. Call me old fashion, but I really prefer doing things be hand. I didn’t like the thought of having to type ruby1.8.6 vs ruby1.8.7 proposed by Michael Greenly, but I did pick up a few things from his article. I am interested in the testing against multiple version like multiruby provides. However, the main reason I want different ruby installs is because different clients have different environments. So here is how I did it. For reference, I am using Ubuntu 8.0.4.

  1. Remove all ubuntu ruby packages.


dpkg --list | grep -i ruby

to find all the packages you have installed. Then use

sudo apt-get remove <em>packagename</em>

to remove those packages. We are going to build all of these by hand.

  1. Make sure you have the ubuntu build packages

Run the following to make sure you have packages necessary to build ruby with

sudo apt-get build-dep ruby1.8

This will install stuff like autoconf and automake if you don’t already have them.

  1. Setup your filesystem for stow.

Let’s first make a directory under /usr/local named stow with

sudo mkdir /usr/local/stow

We will install everything here and then use stow to create symlinks in /usr/local/bin. Also, change the directory permission for /usr/local/stow so you can install stuff there as your user. This has the added benefit of alerting you if you configure wrong or try to overwrite something. We will only need to sudo to run the stow command. Run the following to see what groups you are in

groups username

Hopefully there will be a dev or adm or something similiar. I will use the adm group. Run the following to change the group and permissions on /usr/local/stow.

sudo chgrp -R adm /usr/local/stow


chmod -R 775 /usr/local/stow
  1. Install stow

Download the stow package with from ftp://mirrors.kernel.org/gnu/stow/stow-1.3.3.tar.gz. Then

tar -zxf stow-1.3.3.tar.gz

to extract everything. Go into the directory and then run the following.

./configure --prefix=/usr/local

Then install it with make and sudo make install

I considered installing stow under the stow directory but figured it was overkill

  1. Install ruby1.8.6

Get the code with from ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p287.tar.gz.%C2%A0 Unzip and cd into the directory. Run

./configure --prefix=/usr/local/stow/ruby-1.8.6-p287

and then

make && make install

You shouldn’t need to sudo if you have the permissions correct. Run

make install-doc

if you want ri and rdoc, but it takes a while.

  1. Install ruby1.8.7

Much like the 1.8.6 version, get the code with ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.7-p72.tar.gz Unzip and cd into the directory. Run

./configure --prefix=/usr/local/stow/ruby-1.8.7-p72

and then

make && make install

Again run

make install-doc

if you want.

  1. Update your path

Make sure that /usr/local/bin is on your path. Since we don’t have ruby installed anywhere else, you can put it at the end. You could put it earlier if you have other versions installed.

echo $PATH

to see if you already have it. If not, go to your .bashrc and add it where ever PATH is exported.

  1. Run stow

Lets set up ruby 1.8.7. Change to the /usr/local/stow directory and run

sudo stow ruby-1.8.7-p72

All the symlinks are created for you.

  1. Install rubygems, gems and then stow again


ruby -v

should show you it is version 1.8.7. You will need to install rubygems now. Get it from http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz and then extract it into a directory. Change into that directory and run

ruby setup.rb

Now rubygems is installed in the ruby directory, but you will need run stow again. Change to /usr/local/stow and run

sudo stow ruby-1.8.7-p87

Running the command

which gem

should show you have it installed. You can now install gems like mongrel, rails etc. When you finish installing gems, be sure to run stow again so it will symlink the executables.

That’s it. Switching to ruby 1.8.6 is easy. Go to /usr/local/stow and run

stow -D ruby-1.8.7-p22 && stow -R ruby-1.8.6-p287

The -D removes all the symlinks.  Run the following to see all the options for stow

stow -h

Follow the instructions above to setup rubygems and all the gems again. Remember to rerun stow so the executable are symlinked. After you install the gems the first time, switching is simply a matter of stow -D and then stow -R. Pretty clean and easy.

A great thing about stow is I can use it for other packages as well, like mysql or php. I’ll note that ruby doesn’t have a

make uninstall

so it is ugly if you want to remove the packages. With stow, all you have to do is remove the directory.

Notes: I tried to cover most commands I used. If you need more unix reference, try something like this or this. Google is your friend.

In addition to the articles linked above, I also read the following when writing this post one and two

Alright, I give. Rails on shared hosting really sucks. I’ve seen reports of success with Phusion Passenger, but my host doesn’t support it yet. I wrote about my some of this issues I have had. So welcome to wordpress. Same theme, mostly, with less crashes. Maybe this will encourage me to write more.

Since my last post, I have been looking more and more at Merb. Just some random notes

  • Looks like Merb 0.9.2 got some fcgi love. That is what I want to try to replace rails on my shared host.

  • Get on IRC if you need help – irc.freenode.net#merb. Really, IRC.

  • If you can’t stay on IRC, go to http://groups.google.com/group/merb for a log

  • Use these sake tasks if you are running the latest. sudo sake merb:update merb:install will update core, more and plugins

  • merb-rspec is no longer in plugins, but included in core

  • Watch this from Confreaks. Worth the investment.

  • Most tutorials and articles are dated. This one helped though.

Looking forward to more from merb….

UPDATE: Having some trouble with typo’s caching. Going to repost this article.

One more quick post. Last week I purchased an inexpensive (shall I say cheap) laptop from WalMart. It is a Toshiba A215-S5808. I booted once in Vista to burn a cd and them immediately installed Ubuntu 7.10. Almost all my hardware was recognized, except the wireless and sound. This post was very helpful in resolving those issues. It’s only been a week, but I keep asking myself, “Why did I code so long in Windows”.

It has taken me almost 2 months to put this post together, but at the time, DHH’s article on shared hosting support for Rail was very timely. I use shared hosting to run this blog and have had some headaches. This is another great post on the subject. Lots, and I mean lots, of interesting comments. Part of those 2 months was getting through those comments.

So what can we do? Rubinius / mod_rubinus seem really interesting. Long term, this may be a great solution. More immediately, I am intrigued by Rack. Rack is just a webserver abstraction and would not solve the lack of threading in Rails though. But there is a Rack adapter built into Merb, which is thread safe. I will be spending some time looking into Merb and I’ll document my investigation here.

So what headaches have I had with shared hosting. Only a few, because this site doesn’t get much traffic. Here are some details about my setup (warning, here comes an ad). I have the “Small” plan from asmallorange (ASO). The price is very reasonable and the features are good: SSH access, Rails support, unlimited mail accounts, unlimited mysql databases, unlimited subdomains and many other features. Support has been great, they have installed every gem I have asked for within minutes without a hard time, even Camping but that is a story for another time. ASO also has a reseller plan so you can sell off part of your hosting and make a little money. Ok, back to the post.

So what problems have I had with shared hosting? Like most shared hosts ASO uses FastCGI to support Rails. Mongrel is too expensive in a shared hosting environment. My problems have been with FastCGI and limits ASO has in place. They allow 5 instances of FastCGI to run concurrently. Again, no problem with the amount of traffic I get. However, idle instances die after 4 minutes. So at some point, all my instances die and the next request has to startup FastCGI and then serve the page. It can take 2 minutes, which is too long. There are some reaper and spinner scripts in Rails, but I don’t have enough permissions on my server to run them.

Another problem I had came from wanting to mimic my production environment as closely as possible on my laptop. I tried in vain to install Apache with FastCGI. Yes, it is windows and I was using Cygwin, but after 2 weeks of off and on install and configuration failures, I gave up.

If FastCGI is running, I have had no complaints with performance. You can judge that for yourself. I don’t fault ASO either. The restrictions they place on FastCGI make sense for their business model. Shared hosting for Rails is hard, and I think they have done a good job accommodating the community so far. I would recommend them if you want to support for multiple languages, if you are looking for really inexpensive hosting, and if you understand what you are getting into. Certainly they are good as Dreamhost All the other Rails apps I work on are run with mongrel clusters. Currently, I think that is best option for production sites with a decent or even large amounts of traffic. I’ll be interested to see if Ezra recommends anything else in his new book

I do almost all my development using vim/gvim. Vim is great. Yes, I have tried IDEs, and will use Eclipse when doing some java work. Ever since I started developing in Rails though, it has been me and vim.

I see lots of posts with rails code. Many of them are from Textmate, a Mac text editor, and the VibrantInk color scheme looks great. I already use rails.vim which is a great plugin by Tim Pope for rails development. He has also released a color scheme based on VibrantInk called vividchalk. There is another VibrantInk port for vim oddly enough called vibrantink.vim. Both are really good, but I use the vibrantink.vim color scheme getter for couple of reasons. One, it looks better in console vim. Two, the italics in vividchalk through me off.

Here is a screenshot from flicker with a comparison of the 3 made by Jo Vermeulen, the guy who made vibrantink.vim

Now that I have used typo for a couple of days now, I realized it is missing page stats. Maybe it is vanity, but if I am going to spend time posting information, I want to know when someone is looking at it. So I looked on the mailing list and didn’t see anything current that would help. My first thought, right on, now I have a chance to write my first open source plugin. Then I came to my senses and decided to google around.

I found a post on Juixe TechKnow about a plugin from Graeme. Looked pretty good and I have been wanting to try google analytics. I also found this plugin which appears to be an updated version of Graeme’s. I tried the blue egg edition, but was getting errors about a missing Liquid constant. Didn’t feel like adding liquid so I went back to the first plugin.

Install and configuration was simple. Signed up for google analytics, installed the plugin, modified my environment.rb. Now I am collecting stats.

I did run see this discussion on the mailing list about gathering stats from feeds. I have already signed up for feedburner and replaced the syndication sidebar with a static one.

Should I be concerned? Everything has been too straightforward.

The only issue I see is that the plugin uses the older version of google analytics tracking, urchin.js. Last month, google launched a new script, ga.js. See here for more info. Maybe I’ll update the plugin. I also want to check to see if typo is caching the javascript file or downloading it every time.

BTW, Happy New Year.

Well, nothing like waiting until the last minute. My personal weblog has been down for over a year. One of my 2007 new year resolutions was get it back up. Here goes.

Over the past year or so, I have been doing mostly Ruby on Rails work, both personally and professionally. I had to find another job about 3 months ago, and I was dreading having to go back to Java. RoR is just so much fun. I wanted to set my new weblog with RoR and looked at both Typo and Mephisto as well as few others. Why did I choose Typo? I think it was after listening to Stuart Halloway’s podcast. So far so good. I have to say, I am surprised by how easy it was to get set up and going. Much different than my experience with drupal 6 years ago. Surely I know more now, but I am still surprised. I’ll post more info about the set in the about page

I plan to blog mostly about technology, things I find interesting and things I learn. Maybe someone will find it useful.

Thanks for stopping by.