Bundler + Cruise… Take Two

November 25, 2009 Pivotal Labs

Responding to my last post, Josh pointed out what should probably be obvious: It’s likely a bad idea to bundle bundler. There’s a potential for version conflicts.

For our second attempt, we’re

As a second attempt, we’re now cribbing from the continuous integration setup from the Rails project. So far, so good:

Our RAILS_ROOT/cruise_config.rb

require 'fileutils'

Project.configure do |project|
  project.build_command = 'sudo gem update --system && ruby lib/cruise/build.rb'

And, the referenced lib/cruise/build.rb (the important parts)…

#!/usr/bin/env ruby
require 'fileutils'
include FileUtils

def root_dir
    @root_dir ||= File.expand_path(File.dirname(__FILE__) + '/../..')

def rake(*tasks)
  tasks.each { |task| return false unless system("#{root_dir}/bin/rake", task, 'RAILS_ENV=test')}

build_results = {}

cd root_dir do
  build_results[:bundle] = system 'gem bundle'  # bundling here, rather than in a task (not in Rails context)
  build_results[:spec] = rake 'cruise:spec'

failures = build_results.select { |key, value| value == false }

if failures.empty?

Thanks go to

  • Josh Susser for help via email
  • John Pignata for suggesting we look at the Rails project
  • Rails team for the reference scripts

More comments and suggestions are encouraged.

About the Author


Looking for a new challenge? Come work for Pivotal clients!
Looking for a new challenge? Come work for Pivotal clients!

At Pivotal Labs, one of the services we provide is bootstrapping startups, including helping them interview...

Thanks Startup Crawlers!
Thanks Startup Crawlers!

Thanks to all who came out for the Startup Crawl last Friday night. It was a great crowd and by all account...

SpringOne 2021

Register Now