- From: Daniel DeLeo <
>
- To: AJ Christensen <
>
- Cc: FitzGibbon, James <
>, "
" <
>
- Subject: [chef-dev] Re: Re: Announce: chef-dk-template-plugin - easy distribution of ChefDK templates as gems
- Date: Mon, 11 May 2015 18:58:59 -0700
Seconded, great work!
--
Daniel DeLeo
On Monday, May 11, 2015 at 6:34 PM, AJ Christensen wrote:
>
Great work team, looks super dope. Will be stoked to package up some
>
of our generator skels into gems and such.
>
>
IS NAICE
>
>
cheers,
>
>
--aj
>
>
On Tue, May 12, 2015 at 1:23 PM, FitzGibbon, James
>
<
>
>
(mailto:
)>
>
wrote:
>
> Ohai Chefs!
>
>
>
> I would like to announce the first release of chef-dk-template-plugin, a
>
> stab at making it easy to distribute custom ChefDK templates inside and
>
> outside of your organization.
>
>
>
> Here’s a brief demo. Let’s assume you have a plugin class like this:
>
>
>
> require 'chef-dk/template/plugin_base'
>
> require 'chef-dk/template/mixins'
>
>
>
> # the Chef Development Kit
>
> module ChefDK
>
> # templates for 'chef generate'
>
> module Template
>
> # a pluggable framework for distributing templates as ruby gems
>
> class Plugin
>
> # an example plugin for chef-dk-template-plugin
>
> class Example < PluginBase
>
> include ChefDK::Template::Mixin::CookbookBase
>
>
>
> # the version of the gem
>
> VERSION = '0.1.0'
>
>
>
> class << self
>
> def description
>
> 'Example cookbook template'
>
> end
>
> end
>
> end
>
> end
>
> end
>
> end
>
>
>
> And you have a generator recipe like this:
>
>
>
> template = ChefDK::Template::Plugin::Example.new(self)
>
> template.generate
>
>
>
> Now when you run ‘chef generate cookbook foo’, you’ll get a cookbook that
>
> has all the things provided by the ‘CookbookBase’ mixin (things like a
>
> README, CHANGELOG, metadata.rb, etc.)
>
>
>
> Because the generators are Ruby classes:
>
>
>
> - you can extend, inherit and metaprogram them to your heart’s delight
>
>
>
> - you can test them using RSpec or minitest or Aruba/Cucumber
>
>
>
> - you can create mixins for other people to use
>
>
>
> - you can distribute your mixins or templates as ruby gems
>
>
>
> - you can update them using ‘chef gem install’
>
>
>
> My hope is that this will spur more sharing of good cookbook practice
>
> while still allowing you to compose templates that meet the various needs
>
> you have inside your organization.
>
>
>
> Feedback and PRs are welcome.
>
>
>
> Plugin Framework: https://github.com/Nordstrom/chef-dk-template-plugin
>
>
>
> Example Plugin: https://github.com/Nordstrom/chef-dk-template-example
>
>
>
> Cheers
Archive powered by MHonArc 2.6.16.