def run
self.config = Chef::Config.merge!(config)
if @name_args.length < 1
show_usage
ui.fatal("You must specify a cookbook name")
exit 1
end
if default_cookbook_path_empty? && parameter_empty?(config[:cookbook_path])
raise ArgumentError, "Default cookbook_path is not specified in the knife.rb config file, and a value to -o is not provided. Nowhere to write the new cookbook to."
end
cookbook_path = File.expand_path(Array(config[:cookbook_path]).first)
cookbook_name = @name_args.first
copyright = config[:cookbook_copyright] || "YOUR_COMPANY_NAME"
email = config[:cookbook_email] || "YOUR_EMAIL"
license = ((config[:cookbook_license] != "false") && config[:cookbook_license]) || "none"
readme_format = ((config[:readme_format] != "false") && config[:readme_format]) || "md"
create_cookbook(cookbook_path,cookbook_name, copyright, license)
create_readme(cookbook_path,cookbook_name,readme_format)
create_metadata(cookbook_path,cookbook_name, copyright, email, license,readme_format)
end