Setting Up A Chef Build System With Rake

This is the second in a series on the development of Chef Broiler Plate in which we go over setting up a robust, TDD framework for Chef cookbook development.

A mentor of mine once said:

Always start with the build system.

Having already set up our project in the last post, we are ready to do exactly that. The build system is important, as it allows us to collect commonly executed tasks, which will save us time. Right now, we are just fleshing out the task placeholders; in future posts, we will implement these and add new ones. These are the steps I took.

Set Ruby Version

Create .rvmrc and .rbenv-version files to set the Ruby version for the project.

Create a Gemfile

Make a Gemfile to set the project dependencies:

source ""

ruby '1.9.3'

gem 'rake', '10.0.4'

Install the Dependencies

bundle install

Create Rakefile

Create a new Rakefile with placeholder task per those that we outlined in our Readme file:

require "bundler/setup"

task :default => [:list]

desc "Lists all the tasks."
task :list do
  puts "Tasks: \n- #{(Rake::Task.tasks).join("\n- ")}"

desc "Checks for required dependencies."
task :check do
  puts "Nothing to do yet..."

desc "Builds the package."
task :build do
  puts "Nothing to do yet..."

desc "Fires up the Vagrant box."
task :start do
  puts "Nothing to do yet..."

Great! Now we have the beginnings of a build system for the project.

Coming up…

In the next post, we will flesh out the build system with a task that checks for dependencies and implement our Knife configuration.

If you enjoyed reading this or learned something, please consider sharing via , , or . Thanks!