Adding a Recipe

As we’ve already added our tests, we have a pretty good idea of what needs to happen.

With this solution in mind we’ll create a file called recipes/server.rb with the following:

# the default recipe is implied if only the cookbook name is provided
# effectively `include_recipe "git_cookbook::default"`
include_recipe "git_cookbook"

# install the above `daemon_pkg`
package 'git-daemon-run'

# create our data directory
directory '/opt/git'

# setup the systemd unit (service) with the above `daemon_bin`, enable, and
# start it
systemd_unit 'git-daemon.service' do
  content <<-EOU.gsub(/^\s+/, '')
    Description=Git Repositories Server Daemon

    ExecStart=/usr/bin/git daemon \
    --reuseaddr \
    --base-path=/opt/git/ \


  action [ :create, :enable, :start ]

Before we give our new recipe a go, a quick detour to cover how we might exclude a particular platform from a suite’s tests.