Merge pull request #121 from whopper/PDOC-121/master/gh_pages_sha
(PDOC-121) Include tag or SHA in gh_pages task commit
This commit is contained in:
commit
2e64a37327
|
@ -2,7 +2,6 @@ require 'puppet-strings/tasks'
|
||||||
|
|
||||||
namespace :strings do
|
namespace :strings do
|
||||||
namespace :gh_pages do
|
namespace :gh_pages do
|
||||||
desc 'Checkout the gh-pages branch for doc generation.'
|
|
||||||
task :checkout do
|
task :checkout do
|
||||||
if Dir.exist?('doc')
|
if Dir.exist?('doc')
|
||||||
fail "The 'doc' directory (#{File.expand_path('doc')}) is not a Git repository! Remove it and run the Rake task again." unless Dir.exist?('doc/.git')
|
fail "The 'doc' directory (#{File.expand_path('doc')}) is not a Git repository! Remove it and run the Rake task again." unless Dir.exist?('doc/.git')
|
||||||
|
@ -24,7 +23,6 @@ namespace :strings do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Add Jekyll _config.yml file to allow publishing of _index.html.'
|
|
||||||
task :configure do
|
task :configure do
|
||||||
unless File.exist?(File.join('doc', '_config.yml'))
|
unless File.exist?(File.join('doc', '_config.yml'))
|
||||||
Dir.chdir('doc') do
|
Dir.chdir('doc') do
|
||||||
|
@ -33,16 +31,19 @@ namespace :strings do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Push new docs to GitHub.'
|
|
||||||
task :push do
|
task :push do
|
||||||
|
output = `git describe --long 2>/dev/null`
|
||||||
|
# If a project has never been tagged, fall back to latest SHA
|
||||||
|
output.empty? ? git_sha = `git log --pretty=format:'%H' -n 1` : git_sha = output
|
||||||
|
|
||||||
Dir.chdir('doc') do
|
Dir.chdir('doc') do
|
||||||
system 'git add .'
|
system 'git add .'
|
||||||
system "git commit -m '[strings] Generated Documentation Update'"
|
system "git commit -m '[strings] Generated Documentation Update at Revision #{git_sha}'"
|
||||||
system 'git push origin gh-pages -f'
|
system 'git push origin gh-pages -f'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run checkout, generate, and push tasks.'
|
desc 'Update docs on the gh-pages branch and push to GitHub.'
|
||||||
task :update => [
|
task :update => [
|
||||||
:checkout,
|
:checkout,
|
||||||
:'strings:generate',
|
:'strings:generate',
|
||||||
|
|
Loading…
Reference in New Issue