summaryrefslogtreecommitdiff
path: root/chef/lib/chef/knife
diff options
context:
space:
mode:
authorNathen Harvey <nharvey@customink.com>2012-07-26 23:05:27 -0400
committerBryan McLellan <btm@opscode.com>2012-08-02 09:32:55 -0700
commitadb5bf2005154f03b8f8b0492ce4cb538c448222 (patch)
treebd343ca75334bac4ac8b488555e291e10e37833e /chef/lib/chef/knife
parentcb54b52d0f51c42399e3d28e514419a025b540ad (diff)
downloadchef-adb5bf2005154f03b8f8b0492ce4cb538c448222.tar.gz
Adding a CHANGELOG.md file when creating new cookbooks
Diffstat (limited to 'chef/lib/chef/knife')
-rw-r--r--chef/lib/chef/knife/cookbook_create.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/chef/lib/chef/knife/cookbook_create.rb b/chef/lib/chef/knife/cookbook_create.rb
index c9abb26148..5e64cb6a94 100644
--- a/chef/lib/chef/knife/cookbook_create.rb
+++ b/chef/lib/chef/knife/cookbook_create.rb
@@ -75,6 +75,7 @@ class Chef
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_changelog(cookbook_path,cookbook_name)
create_metadata(cookbook_path,cookbook_name, copyright, email, license,readme_format)
end
@@ -179,6 +180,18 @@ EOH
end
end
+ def create_changelog(dir, cookbook_name)
+ msg("** Creating CHANGELOG for cookbook: #{cookbook_name}")
+ unless File.exists?(File.join(dir,cookbook_name,'CHANGELOG.md'))
+ open(File.join(dir, cookbook_name, 'CHANGELOG.md'),'w') do |file|
+ file.puts <<-EOH
+## v0.1.0:
+
+EOH
+ end
+ end
+ end
+
def create_readme(dir, cookbook_name,readme_format)
msg("** Creating README for cookbook: #{cookbook_name}")
unless File.exists?(File.join(dir, cookbook_name, "README.#{readme_format}"))
@@ -248,12 +261,12 @@ EOH
long_description = "long_description IO.read(File.join(File.dirname(__FILE__), 'README.#{readme_format}'))"
end
file.puts <<-EOH
-maintainer "#{copyright}"
-maintainer_email "#{email}"
-license "#{license_name}"
-description "Installs/Configures #{cookbook_name}"
+maintainer '#{copyright}'
+maintainer_email '#{email}'
+license '#{license_name}'
+description 'Installs/Configures #{cookbook_name}'
#{long_description}
-version "0.0.1"
+version '0.0.1'
EOH
end
end