Skip to content

Instantly share code, notes, and snippets.

@sbuzonas
Created October 12, 2014 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbuzonas/87d71c1b227ac64d1f0d to your computer and use it in GitHub Desktop.
Save sbuzonas/87d71c1b227ac64d1f0d to your computer and use it in GitHub Desktop.
# -*- mode: ruby; encoding: utf-8 -*-
COOKBOOK_REPO = File.expand_path('../', __FILE__)
# This method allows uncommitted cookbooks to be included
# Trade-off is install leaves these in place and vendor
# needs to be explicitly called to put all in a vendor path
def development_cookbook(name, version = '>=0.0.0', options = {})
cookbook name, version, { path: File.join(COOKBOOK_REPO, name) }.merge(options)
end
# This method requires cookbooks to be committed to the repo
def local_cookbook(name, version = '>= 0.0.0', options = {})
cookbook name, version, { git: COOKBOOK_REPO, rel: name }.merge(options)
end
# Wrapped in a conditional because OpsWorks doesn't give the option
# to set groups to include or exclude.
if ENV['BUNDLE_GEMFILE']
# Our test harness is configured to detect a chef-repo, install to cookbooks
ENV['BERKSHELF_PATH'] = File.expand_path('../cookbooks', __FILE__)
group :company do
Dir.glob("#{COOKBOOK_REPO}/*/metadata.rb").each{|metadata|
name = File.basename(File.dirname(metadata))
# Most of the time we want to work with our cookbooks as
# they are in repository
development_cookbook name unless ENV['RELEASE']
# When we are testing for a tagged release we need to use
# only committed changes to assert we get the expected results
local_cookbook name if ENV['RELEASE']
}
end
end
source 'http://supermarket.getchef.com'
# We can exclude these when building a sandbox for foodcritic and rubocop
group :third_party do
cookbook 'emacs24-ppa'
cookbook 'hadoop'
cookbook 'java'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment