May 24th, 2009
Over the weekend, I released version 0.5 of the Cerberus gem.
The release included some better test support, as well as support for git branches and custom settings file inclusion for the Maven2 builder.
No, sooner had version 0.5 been released, then we began work in earnest on version 0.6
Mike Gunderloy has been working on adding features to Cerberus to support using a custom Ruby script as a project builder. The main reason, is to build the Rails project using their ci_setup.rb, CruiseControl build script.
The current code with Ruby builder support can be found in the ruby_builder branch of the main repository at the moment.
In addition, Mike wrote an excellent blog post on how he is building Rails using Cerberus and multiruby.
May 20th, 2009
On a recent project I launched, I’m using the combination nginx+passenger for my front end my my Ruby on Rails application.
While trying to boost my YSlow score, I was having a bit of difficulty trying to figure out how to set HTTP expires headers on all the static assets served by my app.
Rails will set an internal time stamp on static assets (images, css files, javascript files, etc…) by appending a integer value onto the end of the asset filename
http://mydomain.com/images/asset.png?12345678
My original attempt at getting nginx to set an expires header for these assets had me adding the following location block to my nginx config file:
location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+$ {
expires max;
break;
}
The regexp I was using was incorrect however as it didn’t take into account that the ?timestamp might not exist in the URI.
Hongli Lai kindly pointed me in the right direction and showed me the proper regexp that he is using.
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
break;
}
May 19th, 2009
Recently while working on a Ruby on Rails plugin, I came across the need to install the plugin from a specific git branch instead of the default master branch.
./script/plugin install -h
yielded the helpful information I needed. Last July, a patch was committed to Rails that added the -r ( or –revision ) parameter.
The -r parameter will take either the name of a git branch or a tag string to checkout instead of the default master branch.
So issuing the following command:
./script/plugin install git://github.com/cpjolicoeur/my_plugin.git -r BRANCH_NAME
will checkout the BRANCH_NAME branch of the git repository.
Very helpful when testing and debugging new features and bugfixes in a plugin.
May 17th, 2009
Recently I deployed a new Ruby on Rails application using nginx+passenger instead of the usual apache+passenger configuration.
As a result, I couldn’t use the traditional Apache rewrite rules to display the maintenance.html page if it existed.
Here are the necessary corresponding rewrite rules for nginx to achieve the same effect.
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
Place this inside your server {} block and you should be able to run cap deploy:web:disable and cap deploy:web:enable with no problems.
February 16th, 2009
Over the past month there have been several small point releases to Cerberus, the most recent being version 0.4.4 released just last night.
The latest changes include some minor bugfixes, better RSpec support, the ability to write and use your own custom publishers, and a cron-like scheduling option for the ‘buildall’ command.
Also of important note, the official tracker for issues and bugs has been moved from RubyForge to a new Lighthouse tracker. Also, a mailing list / public forum has been setup for discussion.
As usual, you can grab the newest gem from RubyForge or download the source code at GitHub.