<commit_before>Description
===========

This is a testable skeleton cookbook designed for you or your organization to
fork and modify appropriately. The cookbook comes with everything you need to
develop infrastructure code with Chef and feel confident about it. See chapter
**Testing** to learn more.

(While you're encouraged to customize everything in this cookbook to fit your
needs, I recommend to keep the Testing chapter as an important part of this
README.)

Requirements
============

## Platform:

*List supported platforms here*

## Cookbooks:

*List cookbook dependencies here*

Attributes
==========

*List attributes here*

Recipes
=======

## skeleton::default

Installs/configures something

Testing
=======

The cookbook comes with some testing facilities allowing you to iterate quickly
on cookbook changes. After installing Vagrant and the required Ruby gems, most
of the testing can be done through convenient Rake tasks.

## Bundler

Apart from Vagrant, which is described later on, all tools you need for cookbook
development and testing are installed as Ruby gems using [Bundler](http://gembundler.com).
This gives you a lot of control over the software stack ensuring that the
testing environment matches your production environment.

First, make sure you have Bundler (which is itself a gem):

    $ gem install bundler

Then let Bundler install the required gems (as defined in `Gemfile`):

    $ bundle install

Now you can use `bundle exec` to execute a command from the gemset, for example:

    $ bundle exec rake

(You should keep `Gemfile.lock` checked in.)

## Rake

The cookbook provides a couple of helpful [Rake](http://rake.rubyforge.org)
tasks (specified in `Rakefile`):

    $ rake -T
    rake clean                      # Remove any temporary products.
    rake clobber                    # Remove any generated file.
    rake test:all                   # Run test:syntax, test:lint, test:spec, and test:integration
    rake test:integration           # Run minitest integration tests with Vagrant
    rake test:integration_teardown  # Tear down VM used for integration tests
    rake test:lint                  # Run Foodcritic lint checks
    rake test:spec                  # Run ChefSpec examples
    rake test:syntax                # Run Knife syntax checks

As mentioned above, use `bundle exec` to start a Rake task:

    $ bundle exec rake test

The `test` task is an alias for `test:all` and also happens to be the default
when no task is given. All test-related tasks are described in more detail
below.

## Knife

The Rake task `test:syntax` will use `knife cookbook test` to run syntax checks
on the cookbook, validating both Ruby files and templates.

## Foodcritic

The Rake task `test:lint` will use [Foodcritic](http://acrmp.github.com/foodcritic/)
to run lint checks on the cookbook. Foodcritic is configured to fail if there
are _any_ warnings that might stop the cookbook from working.

## ChefSpec

The Rake task `test:spec` will run all [ChefSpec](https://github.com/acrmp/chefspec)
examples in the `spec` directory. Built on top of RSpec, ChefSpec allows you to
write unit tests for Chef cookbooks. It runs your cookbook - without actually
converging a node - and lets you make assertions about the resources that were
created. This makes it the ideal tool to get fast feedback on cookbook changes.

## Berkshelf

[Berkshelf](http://berkshelf.com) is used to set up the cookbook and its
dependencies prior to testing with Rake and Vagrant.

The dependencies are defined in `Berksfile`, which in turn resolves the
dependencies in `metadata.rb`. It is good practice to specify the cookbook
sources in `Berksfile`, while keeping the cookbook versions in `metadata.rb`
(the authoritative source of information for Chef).
<commit_msg>Add chapter on minitest to README<commit_after>Description
===========

This is a testable skeleton cookbook designed for you or your organization to
fork and modify appropriately. The cookbook comes with everything you need to
develop infrastructure code with Chef and feel confident about it. See chapter
**Testing** to learn more.

(While you're encouraged to customize everything in this cookbook to fit your
needs, I recommend to keep the Testing chapter as an important part of this
README.)

Requirements
============

## Platform:

*List supported platforms here*

## Cookbooks:

*List cookbook dependencies here*

Attributes
==========

*List attributes here*

Recipes
=======

## skeleton::default

Installs/configures something

Testing
=======

The cookbook comes with some testing facilities allowing you to iterate quickly
on cookbook changes. After installing Vagrant and the required Ruby gems, most
of the testing can be done through convenient Rake tasks.

## Bundler

Apart from Vagrant, which is described later on, all tools you need for cookbook
development and testing are installed as Ruby gems using [Bundler](http://gembundler.com).
This gives you a lot of control over the software stack ensuring that the
testing environment matches your production environment.

First, make sure you have Bundler (which is itself a gem):

    $ gem install bundler

Then let Bundler install the required gems (as defined in `Gemfile`):

    $ bundle install

Now you can use `bundle exec` to execute a command from the gemset, for example:

    $ bundle exec rake

(You should keep `Gemfile.lock` checked in.)

## Rake

The cookbook provides a couple of helpful [Rake](http://rake.rubyforge.org)
tasks (specified in `Rakefile`):

    $ rake -T
    rake clean                      # Remove any temporary products.
    rake clobber                    # Remove any generated file.
    rake test:all                   # Run test:syntax, test:lint, test:spec, and test:integration
    rake test:integration           # Run minitest integration tests with Vagrant
    rake test:integration_teardown  # Tear down VM used for integration tests
    rake test:lint                  # Run Foodcritic lint checks
    rake test:spec                  # Run ChefSpec examples
    rake test:syntax                # Run Knife syntax checks

As mentioned above, use `bundle exec` to start a Rake task:

    $ bundle exec rake test

The `test` task is an alias for `test:all` and also happens to be the default
when no task is given. All test-related tasks are described in more detail
below.

## Knife

The Rake task `test:syntax` will use `knife cookbook test` to run syntax checks
on the cookbook, validating both Ruby files and templates.

## Foodcritic

The Rake task `test:lint` will use [Foodcritic](http://acrmp.github.com/foodcritic/)
to run lint checks on the cookbook. Foodcritic is configured to fail if there
are _any_ warnings that might stop the cookbook from working.

## ChefSpec

The Rake task `test:spec` will run all [ChefSpec](https://github.com/acrmp/chefspec)
examples in the `spec` directory. Built on top of RSpec, ChefSpec allows you to
write unit tests for Chef cookbooks. It runs your cookbook - without actually
converging a node - and lets you make assertions about the resources that were
created. This makes it the ideal tool to get fast feedback on cookbook changes.

## Minitest

The Rake task `test:integration` will run minitest integration tests inside a VM
managed by Vagrant. This is done by adding the [minitest-handler cookbook] to
Chef's run list prior to provisioning the VM. This cookbook will install
[minitest-chef-handler] inside the VM, which in turn runs all
`files/**/*_test.rb` files at the end of the provisioning process.

In case the VM is powered off, `rake test:integration` will boot it up first.
When you no longer need the VM for integration testing, `rake
test:integration_teardown` will shut it down. If you rather want to provision
from scratch, set `INTEGRATION_TEARDOWN` accordingly. For example:

    $ export INTEGRATION_TEARDOWN='vagrant destroy -f'
    $ rake test:integration_teardown
    $ rake test:integration

[minitest-chef-handler]: https://github.com/calavera/minitest-chef-handler
[minitest-handler cookbook]: https://github.com/btm/minitest-handler-cookbook

## Berkshelf

[Berkshelf](http://berkshelf.com) is used to set up the cookbook and its
dependencies prior to testing with Rake and Vagrant.

The dependencies are defined in `Berksfile`, which in turn resolves the
dependencies in `metadata.rb`. It is good practice to specify the cookbook
sources in `Berksfile`, while keeping the cookbook versions in `metadata.rb`
(the authoritative source of information for Chef).

{'fraction_non_alphanumeric': 0.06722885921761537, 'fraction_numerical': 0.0, 'mean_word_length': 3.8517045454545453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1127887', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2219, 'n_words': 1130}