Putting chef cookbooks into RubyGems
Each reuseable cookbook of mine is a GitHub repository that is also a RubyGem. It can be managed by Bundler as a gem file or a git url in the Gemfile.
Since chef's cookbook_path configuration item takes an array, you can examine all the gems loaded by Bundler (say a few dozen rubygem cookbooks).
Something like this to loop through $: and check for a cookbooks directory:
cookbook_path $:.collect {|x| File.join(File.expand_path("..", x), "cookbooks") }.select {|x| File.directory? x }
Once cookbooks are packaged as gems, you might as well add cucumber features, rspec tests, rake tasks, etc. and start treating cookbooks as just another Ruby library project.
I don't know how this works with Chef Server. I deploy chef-solo like any other application using Capistrano.
Written by Tom, Bom
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#