Cookbook Manager Integration

This usage assumes using cookbook manager to manage both 3rd parties cookbooks and self maintenance cookbooks.


Set berks vendor to hooks.

cookbook_path [
  File.expand_path('../../berks-cookbooks', __FILE__)

knife[:before_bootstrap] = "berks vendor"
knife[:before_converge]  = "berks vendor"

## ex. under the bundler environment.
# knife[:before_bootstrap] = "bundle/chef exec berks vendor"
# knife[:before_converge]  = "bundle/chef exec berks vendor"


That is mostly the same as Berkshelf. Use batali install.

knife[:before_bootstrap] = "batali update"
knife[:before_converge]  = "batali update"

## ex. under the bundler environment.
# knife[:before_bootstrap] = "bundle/chef exec batali vendor"
# knife[:before_converge]  = "bundle/chef exec batali vendor"


Ref: librarian-chef#knife-integration

Add librarian-chef to Gemfile, and bundle it.

gem 'knife-zero'
gem 'librarian-chef'

Stick the following in your knife.rb:

require 'librarian/chef/integration/knife'
cookbook_path Librarian::Chef.install_path,

For example. knife.rb in your chef_repo root.

require 'librarian/chef/integration/knife'
cookbook_path Librarian::Chef.install_path,
              File.expand_path("../site-cookbooks", __FILE__)

When you see Cheffile and Cheffile.lock are out of sync!, you should correct dependency below two ways.



Fork me on GitHub