TIL: put chef generate options in configuration file

Published 2016-04-21 by Jochen Lillich

chef generate is a handy tool to create cookbooks or components of it from the command line. It creates the all the necessary files and best: first test files!

chef generate also creates comment headers in all files from command line options, ie. -C "freistil IT Ltd." -m ops@freistil.it -I apache2 in our case.

To make life easier chefdk supports configuration options which are put in ~/.chef/config.rb:

if defined?(ChefDK)
  chefdk.generator.license = 'apache2'
  chefdk.generator.copyright_holder = 'freistil IT Ltd.'
  chefdk.generator.email = 'ops@freistil.it'

This looks like an undocumented feature, an issue on github/chef-dk got my attention to this.