Since I tripped over a few things setting up Bamboo for Rails, I thought it would be good to share my approach. After my last post, someone from Atlassian thought that would be a good idea as well, so, what the heck.
Creating a Simple Rails Project
In order to demonstrate configuring a project on Bamboo, it's easiest for me just to create a simple rails project, with a model and scaffold. This'll come with tests, albeit useless ones. But if you wanted a tutorial on how to use Rails, you've come to the wrong place.
geoffrey@paraietta:~/projects$ rails bamboo-rails
geoffrey@paraietta:~/projects$ cd bamboo-rails/
geoffrey@paraietta:~/projects/bamboo-rails$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database `bamboo-rails_development`;
Query OK, 1 row affected (0.01 sec)
mysql> create database `bamboo-rails_test`;
Query OK, 1 row affected (0.00 sec)
geoffrey@paraietta:~/projects/bamboo-rails$ script/generate model foo bar:string baz:string
geoffrey@paraietta:~/projects/bamboo-rails$ rake db:migrate
== CreateFoos: migrating ======================================================
== CreateFoos: migrated (0.0041s) =============================================
geoffrey@paraietta:~/projects/bamboo-rails$ script/generate scaffold foo
Add the Project to Source Control
Once the project's created, it has to be somewhere that Bamboo can reach it. The usual practice is a source control system. In this case, I'm using Subversion.
geoffrey@paraietta:~/projects$ svn import bamboo-rails http://messis/svn/spikes/bamboo-rails -m "A simple Rails/Bamboo integration project."
Committed revision 190.
Configure Bamboo for Ruby
In order to build anything in Bamboo/Ruby, you're going to want to configure a builder in Bamboo. There may be a way to use one of the existing builders, but this is what worked for me. Just add a builder for Ruby and point it to your ruby executable.
Create a Plan for your Ruby Project
You're going to want to create a Project and Plan for your Ruby project. Bamboo projects are umbrellas for related Plans:
Plans tell Bamboo what you're trying to build, where to find the source code:
They also tell Bamboo how to build what it finds:
They also tell Bamboo what to do with the results, and whom to notify, but those steps aren't unique to Rails in any way, so I'm going to leave them out. At this point, you have a project and plan defined in Bamboo, so you can check to see if it worked:
It didn't. I didn't create the database on the build server. Once I've done that: