Giter VIP home page Giter VIP logo

cookbook_wrapper_generator's Introduction

This is a pattern for a generator cookbook structured as a wrapper cookbook.

Unfortunately the Berksfile mechanism to find dependent cookbooks does not work with generators provided to the 'chef generate' command.

Solution:

  • create your repo for your generator cookbook, called say 'chef_generator'
  • create a cookbooks directory under it
  • run 'chef generate generator' from within the cookbooks dir, to get the wrapped cookbook
  • create a second wrapper cookbook in the same directory and customize as needed
  • now the dependent/wrapped cookbook can be found, as it is under the same cookbooks directory as the wrapper cookbook

The whole repo for the generator should probably be cloned somewhere other than within your usual cookbooks directory, as it isn't a regular cookbook. One suggestion is to clone it at ~/chef-repo/chef_generator.

If you do that, to use it, put the following in your config.rb (or knife.rb if still using that):

chefdk.generator_cookbook "#{ENV['HOME']}/chef-repo/chef_generator/cookbooks/code_generator_wrapper'

Then, chef generate command will then use it by default as the generator cookbook. You should see much cleaner output, like this:

$ chef generate cookbook example
Generating cookbook example
- Ensuring correct cookbook file content

Your cookbook is ready. Type `cd example` to enter it.

wrapper_generator

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.