Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

knife-api Chef Tool

A small library that lets you drive Chef's `knife` programmatically

Install & Usage Instructions

Installation

Add this line to your application's Gemfile:

gem 'knife-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install knife-api

Usage

The main feature of this library is the ability to drive knife as a method call as opposed to an individual program. This has a number of benefits:

  • It's a lot faster
  • You can capture output
  • You're relying on code that has a contract to maintain compatible with Chef
  • Use knife plugins all you want without breaking your workflow
  • Optionally, Chef becomes constrained by a gemfile (as do the plugins you use) and that constraint remains consistent.

It provides two calls, knife and knife_capture that are injected into the top-level namespace automatically. Additionally, if you are using rake, it will detect this and make it available to rake's DSL as well.

If you wish to use this code elsewhere, just include Chef::Knife::API into your classes/modules.

Both commands take two argument-passing styles. Both use an array of strings to represent the ARGV passed to knife, but there is additionally a shorthand to make the actual subcommand stand out: if you supply a symbol or string with underscore-delimited subcommand names, it will automatically convert this for you. This allows you to visually distinguish a command from its arguments.

knife-api allows the use of alternative Chef Configs via the CHEF_CONFIG environment variable.