Skip to content

Commit

Permalink
publishing to gh-pages now
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Sep 21, 2011
1 parent 7217a7c commit a9f65dc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Rakefile
@@ -1,4 +1,5 @@
require 'script/merge'
require 'script/html'
require 'script/pdf'
require 'script/prince'
require 'script/prince'
require 'script/publish'
6 changes: 2 additions & 4 deletions layout/book_index_template.html
Expand Up @@ -59,9 +59,9 @@ <h3>The Git Community Book</h3>
<div id="download">
<h3>Download</h3>
<div class="inner">
Click <a href="book.pdf">here</a> to download the current PDF version of this book.
Click <a href="https://github.s3.amazonaws.com/media/book.pdf">here</a> to download the current PDF version of this book.
<hr/>
<a href="book.pdf"><img height="50" border="0" src="assets/images/pdf.png"/></a>
<a href="https://github.s3.amazonaws.com/media/book.pdf"><img height="50" border="0" src="assets/images/pdf.png"/></a>
</div>
</div>
</div>
Expand Down Expand Up @@ -115,8 +115,6 @@ <h3>New to Git?</h3>
pageTracker._initData();
pageTracker._trackPageview();
</script>
<script src="http://static.getclicky.com/40584.js" type="text/javascript"></script>
<noscript><p><img alt="Clicky" src="http://in.getclicky.com/40584-db6.gif" /></p></noscript>

</body>
</html>
26 changes: 26 additions & 0 deletions script/publish.rb
@@ -0,0 +1,26 @@
task :publish do
File.open("output/CNAME", 'w+') do |f|
f.puts("book.git-scm.com")
end

ENV['GIT_DIR'] = File.expand_path(`git rev-parse --git-dir`.chomp)
old_sha = `git rev-parse refs/remotes/origin/gh-pages`.chomp
Dir.chdir('output/book') do
ENV['GIT_INDEX_FILE'] = gif = '/tmp/dev.gb.i'
ENV['GIT_WORK_TREE'] = Dir.pwd
File.unlink(gif) if File.file?(gif)
`git add -A`
tsha = `git write-tree`.strip
puts "Created tree #{tsha}"
if old_sha.size == 40
csha = `echo 'boom' | git commit-tree #{tsha} -p #{old_sha}`.strip
else
csha = `echo 'boom' | git commit-tree #{tsha}`.strip
end
puts "Created commit #{csha}"
puts `git show #{csha} --stat`
puts "Updating gh-pages from #{old_sha}"
`git update-ref refs/heads/gh-pages #{csha}`
`git push origin gh-pages`
end
end

0 comments on commit a9f65dc

Please sign in to comment.