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

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Bundler + Cruise… Take Two

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'
end

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__) + '/../..')
end

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

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'
end

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

if failures.empty?
  exit(0)
else
  exit(-1)
end

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.

Comments
  1. Chad Woolley says:

    Rails is still using GemInstaller to [bootstrap itself and autoupdate rubygems](http://github.com/rails/rails/blob/6ac32a83283f46b55675ddf4ecab6c91f6f8abde/ci/geminstaller.yml). That’s kinda silly, but still required to be called my automated CI box setup scripts (which are still [languishing in my branch](http://github.com/thewoolleyman/rails/tree/master/ci/) while I reconsider the approach…)

    There should be something like this in bundler itself – like a shell script that you can wget and install with a one-liner. e.g.:

    wget -O /tmp/bootstrap_bundler.sh http://github.com/wycats/bundler/raw/master/ci/bootstrap_bundler.sh && sh /tmp/bootstrap_bundler.sh
    
  2. Chad Woolley says:

    [Opened a Ticket](http://github.com/wycats/bundler/issues/#issue/122) to add this to Bundler…

  3. Whatever JS you guys are using to add “Read more: ” to copy and paste screws up newline formatting on code samples.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *