Thursday, February 6, 2014

Test Driven Chef Cookbooks With Meez [feedly]




Test Driven Chef Cookbooks With Meez
// Planet DevOps

When cooking a new dish, things get out of control if you try to manage too many things at once

You might face a similar situation when trying to write a new Chef cookbook.

Getting your arms around all those tools and frameworks needed to write solid, tested cookbooks gets you spinning. You need to install Food Critic, Chef Spec, Berkshelf – and the list goes on. This set up can easily take up to half a day or more.

French Chefs arrange all the ingredients which they'll need well before they start cooking. They call this set up procedure „Mise en place", or in short „Meez".

And you should do the same

That's what Meez is all about. It's a Ruby Gem which creates a cookbook for you which has puts all these tools in place before you start cooking. Now you can work like a professional Chef concentrating on the recipe at hand instead of juggling new tools.

Meez needs a Ruby installation

Meez manages all dependencies using Bundler. To install it on your box run:

gem install bundler

Additionally, make sure you've got VirtualBox and Vagrant installed, too.

Let's create a cookbook called my_cookbook using Meez

  1. Install the Meez Gem:

    $ gem install meez

  2. Let's ask meez to create our cookbook:
    $ meez -C "Matthias Marschall" -m mm@agileweboperations.com -I apachev2 my_cookbook
  3. Time to install all required gems:
    $ cd ./cookbooks/my_cookbook
    $ bundle install

  4. Install all dependent cookbooks using Berkshelf:
    $ bundle exec berks install

  5. Time to run all auto-generated test suites:

    $ bundle exec strainer test

    Start writing your cookbook

    If you add new dependencies to your metadata.rb, you need to run bundle exec berks install again.

    Then you can re-run your complete test suite using bundle exec strainer test

    Read more about the ideas behind Meez in The Lazy SysAdmin's Guide to Test Driven Chef Cookbooks written by the author of Meez: Paul Czarkowski (@pczarkowski)



----
Shared via my feedly reader


Sent from my iPhone

No comments:

Post a Comment