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

RSS

generator-cookbook (1) Versions 0.1.0

Installs / configures generated_cookbook

Berkshelf
Policyfile
Knife
cookbook 'generator-cookbook', '~> 0.1.0'
cookbook 'generator-cookbook', '~> 0.1.0', :supermarket
knife supermarket install generator-cookbook
knife supermarket download generator-cookbook
README
Dependencies
Quality 50%

Chef Generator Cookbook

Build Status

Generator cookbook for creating new cookbooks using chef generate cookbook COOKBOOK_NAME --generator-cookbook. Checkout [test/desired_cookbook/](./test/desired_cookbook/) to see how a generated cookbook will look.

Usage

  1. Download the cookbook available from Chef Supermarket
  2. Generate a cookbook using chef generate cookbook ... from chef-dk, passing in the path to this generator-cookbook as an argument
# download the cookbook from the supermarket
curl -L https://supermarket.chef.io/cookbooks/generator-cookbook/download | tar xz

# install `chef` utility from chef-dk if you don't already have it
which chef || gem install chef-dk --no-document

# generate your new cookbook using the generator repo as a template
chef generate cookbook COOKBOOK_NAME \
  --copyright 'Copyright Holder' \
  --email 'email@domain.com' \
  --license 'apachev2' \
  --generator-cookbook generator-cookbook

Differences from default generator

  • Each generated file includes a simple code example to get you started in that file
  • Test-kitchen and Chefspec Travis CI setup generated
  • Gemfile generated
  • This generator always uses Berkshelf rather than Policyfile
  • There is no Chef Delivery support

Here is a comparison of the file trees created by this generator and the default chef-dk generator:

this_generator/                default_chef-dk_generator/
  .gitignore                     .gitignore
  .kitchen.docker.yml            .kitchen.yml
  .kitchen.yml                   Berksfile
  .rspec                         LICENSE
  .travis.sh                     README.md
  .travis.yml                    chefignore
  Berksfile                      metadata.rb
  Gemfile                        recipes/
  LICENSE                          default.rb
  README.md                      spec/
  attributes/                      spec_helper.rb
    default.rb                     unit/
  chefignore                         recipes/
  metadata.rb                          default_spec.rb
  recipes/                       test/
    default.rb                     integration/
  spec/                              default/
    recipes/                           default_test.rb
      default_spec.rb
    spec_helper.rb             7 directories, 11 files
  test/
    fixtures/
      cookbooks/
        fixture_cookbook/
          metadata.rb
          recipes/
            default.rb
    integration/
      default/
        default_spec.rb

11 directories, 19 files

Development

Generating with this cookbook is tested in Travis - a cookbook is generated and then compared to [test/desired_cookbook](./test/desired_cookbook/).

When developing the generator cookbook, its handy to run the generator and see if your changes work as you intended:

# clear generated_cookbook/ and generate into it
rm -rf generated_cookbook
bundle exec chef generate cookbook generated_cookbook \
  --copyright 'Copyright Holder' \
  --email 'email@domain.com' \
  --license 'apachev2' \
  --verbose \
  --generator-cookbook .

# compare the file trees of test/desired_cookbook/ and generated_cookbook/
mkdir -p tmp
tree -aF test/desired_cookbook > tmp/desired_cookbook.tree
tree -aF generated_cookbook > tmp/generated_cookbook.tree
git diff --no-index tmp/*.tree

# diff the contents of test/desired_cookbook/ and generated_cookbook/
git diff --no-index test/desired_cookbook generated_cookbook

Releasing

Ensure your local master branch is up to date with changes and metadata version increase. Then use stove to create and push a git tag and the push cookbook to the supermarket.

bundle exec stove --username atheiman --key ~/.chef/atheiman-chef.io.pem

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.1.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.1.0 passed this metric

No Binaries Metric
            

0.1.0 passed this metric

Publish Metric
            

0.1.0 passed this metric

Supported Platforms Metric
            

0.1.0 failed this metric

generator-cookbook should declare what platform(s) it supports.

Testing File Metric
            

0.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.1.0 passed this metric