Skip to content

Commit a9f65dc

Browse files
committed
publishing to gh-pages now
1 parent 7217a7c commit a9f65dc

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

Rakefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'script/merge'
22
require 'script/html'
33
require 'script/pdf'
4-
require 'script/prince'
4+
require 'script/prince'
5+
require 'script/publish'

layout/book_index_template.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ <h3>The Git Community Book</h3>
5959
<div id="download">
6060
<h3>Download</h3>
6161
<div class="inner">
62-
Click <a href="book.pdf">here</a> to download the current PDF version of this book.
62+
Click <a href="https://github.s3.amazonaws.com/media/book.pdf">here</a> to download the current PDF version of this book.
6363
<hr/>
64-
<a href="book.pdf"><img height="50" border="0" src="assets/images/pdf.png"/></a>
64+
<a href="https://github.s3.amazonaws.com/media/book.pdf"><img height="50" border="0" src="assets/images/pdf.png"/></a>
6565
</div>
6666
</div>
6767
</div>
@@ -115,8 +115,6 @@ <h3>New to Git?</h3>
115115
pageTracker._initData();
116116
pageTracker._trackPageview();
117117
</script>
118-
<script src="http://static.getclicky.com/40584.js" type="text/javascript"></script>
119-
<noscript><p><img alt="Clicky" src="http://in.getclicky.com/40584-db6.gif" /></p></noscript>
120118

121119
</body>
122120
</html>

script/publish.rb

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
task :publish do
2+
File.open("output/CNAME", 'w+') do |f|
3+
f.puts("book.git-scm.com")
4+
end
5+
6+
ENV['GIT_DIR'] = File.expand_path(`git rev-parse --git-dir`.chomp)
7+
old_sha = `git rev-parse refs/remotes/origin/gh-pages`.chomp
8+
Dir.chdir('output/book') do
9+
ENV['GIT_INDEX_FILE'] = gif = '/tmp/dev.gb.i'
10+
ENV['GIT_WORK_TREE'] = Dir.pwd
11+
File.unlink(gif) if File.file?(gif)
12+
`git add -A`
13+
tsha = `git write-tree`.strip
14+
puts "Created tree #{tsha}"
15+
if old_sha.size == 40
16+
csha = `echo 'boom' | git commit-tree #{tsha} -p #{old_sha}`.strip
17+
else
18+
csha = `echo 'boom' | git commit-tree #{tsha}`.strip
19+
end
20+
puts "Created commit #{csha}"
21+
puts `git show #{csha} --stat`
22+
puts "Updating gh-pages from #{old_sha}"
23+
`git update-ref refs/heads/gh-pages #{csha}`
24+
`git push origin gh-pages`
25+
end
26+
end

0 commit comments

Comments
 (0)