diff --git a/Gemfile b/Gemfile index 8a0609b..13d68ad 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source "https://rubygems.org" gem "chef" +gem "rake" gem "berkshelf", "~>1.4" gem "foodcritic" gem "chef-rewind" diff --git a/Rakefile b/Rakefile index 53da72e..f6e1eda 100644 --- a/Rakefile +++ b/Rakefile @@ -53,7 +53,7 @@ task :bundle_cookbook, :cookbook do |t, args| FileUtils.mkdir(temp_dir) FileUtils.mkdir(temp_cookbook_dir) - child_folders = [ "cookbooks/#{args.cookbook}", "site-cookbooks/#{args.cookbook}" ] + child_folders = [ "cookbooks/#{args.cookbook}", "~/.berkshelf/cookbooks/#{args.cookbook}" ] child_folders.each do |folder| file_path = File.join(TOPDIR, folder, ".") FileUtils.cp_r(file_path, temp_cookbook_dir) if File.directory?(file_path) @@ -64,13 +64,37 @@ task :bundle_cookbook, :cookbook do |t, args| FileUtils.rm_rf temp_dir end -desc "Run librarian" -task :librarian do - puts "** Syncing with Cheffile" - system("librarian-chef install") -end - # Extend the existing task to also call librarian task :update do Rake::Task[:librarian].invoke end + +desc "Generate all docs" +task :docs => ["docs:nodes", "docs:roles", "docs:html"] + +namespace :docs do + pwd = File.expand_path(File.dirname(__FILE__)) + + desc "generate node info for docs" + task :nodes do + outfile = "#{pwd}/doc/nodes.rst" + system("bundle exec knife reporter nodes rst -o #{outfile}") + puts "Wrote node documentation to #{outfile}" + end + + task :roles do + outfile = "#{pwd}/doc/roles.rst" + system("bundle exec knife reporter roles rst -o #{outfile}") + puts "Wrote role documentation to #{outfile}" + end + + desc "generate html documents" + task :html do + system("cd #{pwd}/doc && make html") + end + + desc "publish to readthedocs.org" + task :publish do + system("cd #{pwd}/doc && make rtd") + end +end