From 84e6ade5878af7891aadb948707fe9aeadf4aec4 Mon Sep 17 00:00:00 2001 From: David Danzilio Date: Thu, 7 Apr 2016 17:13:39 -0400 Subject: [PATCH] Adding GitHub Pages tasks --- lib/puppet-strings/rake_tasks.rb | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/puppet-strings/rake_tasks.rb b/lib/puppet-strings/rake_tasks.rb index a7329f1..5a9cec7 100644 --- a/lib/puppet-strings/rake_tasks.rb +++ b/lib/puppet-strings/rake_tasks.rb @@ -15,4 +15,37 @@ namespace :strings do task :serve do PuppetX::PuppetLabs::Strings::Util.serve end + + namespace :gh_pages do + git_uri = `git config --get remote.origin.url`.strip + + desc "Checkout the gh-pages branch for doc generation." + task :checkout do + unless Dir.exist?('doc') + Dir.mkdir('doc') + Dir.chdir('doc') do + system 'git init' + system "git remote add origin #{git_uri}" + system 'git pull' + system 'git checkout -b gh-pages' + end + end + end + + desc "Push new docs to GitHub." + task :push do + Dir.chdir('doc') do + system 'git add .' + system "git commit -m '[strings] Generated Documentation Update'" + system 'git push origin gh-pages -f' + end + end + + desc "Run checkout, generate, and push tasks." + task :update => [ + :checkout, + :'strings:generate', + :push, + ] + end end