def create_cookbook(dir, cookbook_name, copyright, license)
msg("** Creating cookbook #{cookbook_name}")
shell_out "mkdir -p #{File.join(dir, cookbook_name, "attributes")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "recipes")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "definitions")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "libraries")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "resources")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "providers")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "files", "default")}"
shell_out "mkdir -p #{File.join(dir, cookbook_name, "templates", "default")}"
unless File.exists?(File.join(dir, cookbook_name, "recipes", "default.rb"))
open(File.join(dir, cookbook_name, "recipes", "default.rb"), "w") do |file|
file.puts "#\n# Cookbook Name:: \#{cookbook_name}\n# Recipe:: default\n#\n# Copyright \#{Time.now.year}, \#{copyright}\n#\n"
case license
when "apachev2"
file.puts "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n"
when "none"
file.puts "# All rights reserved - Do Not Redistribute\n#\n"
end
end
end
end