Knife Cookbook Dependencies

A knife plugin to retrieve cookbook dependencies.

Getting Started

Install

$ gem install knife_cookbook_dependencies

Use

Cookbookfile

Dependencies are managed via a ‘Cookbookfile` in the directory where you want the cookbooks to be installed. The Cookbookfile, like Bundler’s Gemfile, contains which cookbooks are needed and, optionally, where to find them:

cookbook 'memcached'
cookbook 'nginx'
cookbook 'my_app', path: '/path/to/cookbook'
cookbook 'mysql', git: 'git://github.com/opscode-cookbooks/mysql.git'

CLI

The CLI consists of 3 commands: install, update, clean

$ knife cookbook dependencies (install|update) [(--without|-W) group_to_exclude]
$ knife cookbook dependencies clean
note

‘knife cookbook dependencies` subcommands can be used by its alias `knife cookbook deps`

install

Installs the from the Cookbookfile.lock, or Cookbookfile if the the lockfile does not exist.

update

Skips the lockfile and installs fresh

clean

Removes all of the files managed by the ‘Cookbookfile`, including the `Cookbookfile.lock`, temp directory used for downloads and extractions and the cookbooks directory.

The Cookbookfile

Cookbooks are defined as dependencies by declaring them in the ‘Cookbookfile`

cookbook 'nginx'

Cookbooks without additional options are assumed to come from the Opscode Community site at the latest available version: community.opscode.com/cookbooks

Options available include:

version constraint

cookbook "nginx", "= 0.101.2"    # precisely 0.101.2
cookbook "mysql", "< 1.2.4"      # less than and not including 1.2.4
cookbook "openssl", "~> 1.0.0"   # greater than 1.0.0, and up to but not including 1.1.0

git

# ref can be a branch name, tag, or commit hash. If ref is not provided, HEAD is used.
cookbook "mysql", git: "https://github.com/opscode-cookbooks/mysql.git", ref: "<any git ref>"

path

# knife cookbook dependencies will look in /path/to/location/of/my_application for the cookbook
cookbook "my_application", path: "/path/to/location/of"

Groups

Groups can be defined via blocks or inline as an option:

group :solo do
  cookbook 'base'
end

cookbook 'base', :group => 'solo'

When using install or update, groups can be excluded with the –without GROUP_NAME or -W GROUP_NAME flags.

Contributing

Running tests

Install prerequisites

Install the latest version of Bundler

$ gem install bundler

Clone the project

$ git clone git://github.com/RiotGames/knife_cookbook_dependencies.git

and run:

$ cd knife_cookbook_dependencies
$ bundle install

Bundler will install all gems and their dependencies required for testing and developing.

Running unit (RSpec) and acceptance (Cucumber) tests

$ bundle exec guard start

Authors and Contributors