Skip to content

Commit

Permalink
Merge pull request #691 from prawnpdf/manual-cover-git
Browse files Browse the repository at this point in the history
add git commit information on manual's cover only if in Git repo
  • Loading branch information
practicingruby committed Mar 10, 2014
2 parents d6354b9 + 62d1408 commit 6dbe601
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions manual/manual/cover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@
:size => 60}
], :at => [170, cursor - 160])

#long git commit hash
#commit = `git show --pretty=%H`
#short git commit hash
commit = `git show --pretty=%h`
if Dir.exist?("#{Prawn::BASEDIR}/.git")
#long git commit hash
#commit = `git show --pretty=%H`
#short git commit hash
commit = `git show --pretty=%h`
git_commit = "git commit: #{commit}"
else
git_commit = ""
end

formatted_text_box([ {:text => "Last Update: #{Time.now.strftime("%Y-%m-%d")}\n"+
"Prawn Version: #{Prawn::VERSION}\n"+
"git commit: #{commit}",
git_commit,
:size => 12}
], :at => [390, cursor - 620])

Expand Down

0 comments on commit 6dbe601

Please sign in to comment.