Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

  • Blog Navigation
Rails 3 with RVM and Cruise Control

Here are a few notes on how to get individual CruiseControl.rb project Builders running with RVM.

[Note: I’m making an assumption here that you know and understand Bundler and RVM.]

[Also: Cruise may or may not be running on RVM]

Create and check in a .rvmrc file in your rails root directory. Here’s an example.

rvm ruby-1.8.7-p174@rails-example

Then, add a project build command to your cruise_config.rb file.

Project.configure do |project|
  project.build_command = './'

Finally, create a file. The bash script setups rvm and just calls your cruise control build task.

[Note: Your cruise rake task should probably call Bundler’s “bundle install”.]


source $HOME/.rvm/scripts/rvm && source .rvmrc

rake cc:build

…and your cruise project builder is now using RVM!

  • Chad Woolley

    The best shebang is:

    #!/usr/bin/env bash

    Also, using an .rvmrc IS centralizing your settings – for developers as well as CI.

    — Chad

  • Alex Chaffee

    An `.rvmrc` file changes the current ruby every time you `cd` into its directory. But the preferred version for an individual developer may or may not be the preferred version for a collective CI instance. So I prefer not to check in `.rvmrc` files because that would clobber individual developers’ own ruby settings. (How annoying would it be if you were working on 1.9 compatibility and kept getting your ruby switched out to 1.8? Or if you accidentally checked in your 1.9 .rvmrc and annoyed everyone else?)

    Also, I’d like to get CI to run the same tests on many rubies, one after another. I’m already doing that in [Wrong]( and I may do it in Erector (extending the above script) soon. But if I were using an `.rvmrc` then it would naturally conflict with all but one of the iterations…

    So if you agree with me then `.rvmrc` should always be in `.gitignore` and never checked in.

  • Curtis Schofield

    @Chad Wooley

    On ubuntu it is :

    #!/bin/env bash

    Do you know any way to detect that?

    I agree that .rvmrc is a centralized setting – avoid checking it in by accident if you change it.

  • Curtis Schofield

    btw Mike – nice post!

  • Thanks for the post Mike. I had major issues getting RVM to play nice with CC, but this post did help.

    As an aside, I found Hudson more straightforward, and will be writing up instructions on how to set up Hudson + RVM + gemsets on Ubuntu.

  • Mike Barinek

    Hi Sandeep,

    We also use hudson. You might also like cimonitor –

    it’s been a while, we should catch up soon…

  • Reccur Nishan

    Thanks man! Awesome post. :)

Share This