#
# Cookbook:: irrigate-orchard_base
# Recipe:: default
#
# Copyright: The Orchard
#

include_recipe '::locale'

# Include the supermarket chrony cookbook
include_recipe 'chrony'

# Include the upstream logrotate cookbook
include_recipe 'logrotate'

if node['directories'] && !node['directories'].empty?
  node['directories'].each do |directory_name, directory_info|
    directory directory_name do
      path directory_info['path']
      owner directory_info['owner']
      group directory_info['group']
      mode directory_info['mode']
      action [:create]
    end
  end
else
  puts 'There are no managed directories. Moving along...'
end

if node['files'] && !node['files'].empty?
  node['files'].each do |file_name, file_info|
    file file_name do
      path file_info['path']
      content file_info['content']
      owner file_info['owner']
      group file_info['group']
      mode file_info['mode']
      action [:create]
    end
  end
else
  puts 'There are no managed files. Moving along...'
end

if node['links'] && !node['links'].empty?
  node['links'].each do |link_name, link_info|
    link link_name do
      target_file link_info['target_file']
      to link_info['to_file']
      action [:create]
    end
  end
else
  puts 'There are no managed links. Moving along...'
end
