Last active
February 4, 2016 02:55
-
-
Save zuazo/659efb7c52a5fb357bf3 to your computer and use it in GitHub Desktop.
Berksfile template for a Chef Cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# More info at http://berkshelf.com/#the-berksfile | |
source 'https://supermarket.chef.io' | |
my_cookbook = ::File.basename(Dir.pwd).sub(/[-_]?cookbook$/, '') | |
# Berkshelf helper to include a local cookbook from disk. | |
# | |
# @param name [String] cookbook name. | |
# @param version [String] cookbook version requirement. | |
# @param options [Hash] #cookbook method options. | |
# @example | |
# cookbook 'apt' | |
# cookbook 'apt', '~> 2.8' | |
# return void | |
def local_cookbook(name, version = '>= 0.0.0', options = {}) | |
cookbook(name, version, { | |
path: "../../cookbooks/#{name}" | |
}.merge(options)) | |
end | |
metadata | |
cookbook 'apt' | |
cookbook 'freebsd' | |
cookbook 'selinux' # Recommended for some cookbooks like MySQL | |
# Minitest Chef Handler | |
# More info at https://github.com/calavera/minitest-chef-handler | |
if ::File.directory?(::File.join('files', 'default', 'tests', 'minitest')) || | |
::File.directory?( | |
::File.join( | |
'test', 'cookbooks', "#{my_cookbook}_test", 'files', 'default', 'tests', | |
'minitest' | |
) | |
) | |
cookbook 'minitest-handler' | |
end | |
# Integration tests cookbook: | |
if ::File.directory?("./test/cookbooks/#{my_cookbook}_test") | |
cookbook "#{my_cookbook}_test", path: "./test/cookbooks/#{my_cookbook}_test" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment