From a9f65dcb391718e48d5817b65894ed842fb522ad Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Wed, 21 Sep 2011 15:48:18 -0700 Subject: [PATCH 1/3] publishing to gh-pages now --- Rakefile | 3 ++- layout/book_index_template.html | 6 ++---- script/publish.rb | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 script/publish.rb diff --git a/Rakefile b/Rakefile index 9d1b23b8..24ad9657 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ require 'script/merge' require 'script/html' require 'script/pdf' -require 'script/prince' \ No newline at end of file +require 'script/prince' +require 'script/publish' diff --git a/layout/book_index_template.html b/layout/book_index_template.html index 1659a0d5..6c966fd7 100644 --- a/layout/book_index_template.html +++ b/layout/book_index_template.html @@ -59,9 +59,9 @@

The Git Community Book

Download

- Click here to download the current PDF version of this book. + Click here to download the current PDF version of this book.
- +
@@ -115,8 +115,6 @@

New to Git?

pageTracker._initData(); pageTracker._trackPageview(); - - diff --git a/script/publish.rb b/script/publish.rb new file mode 100644 index 00000000..827626d9 --- /dev/null +++ b/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 From e39e237fef408b0fb03a4c43d414adaff341e5f3 Mon Sep 17 00:00:00 2001 From: Chris Ledet Date: Thu, 22 Sep 2011 10:18:48 -0400 Subject: [PATCH 2/3] Edit Stashing - corrected command for saving stash --- text/16_Stashing/0_ Stashing.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/16_Stashing/0_ Stashing.markdown b/text/16_Stashing/0_ Stashing.markdown index 81d12c42..27462747 100644 --- a/text/16_Stashing/0_ Stashing.markdown +++ b/text/16_Stashing/0_ Stashing.markdown @@ -7,7 +7,7 @@ state of your work, and after fixing the bug (or, optionally after doing so on a different branch and then coming back), unstash the work-in-progress changes. - $ git stash "work in progress for foo feature" + $ git stash save "work in progress for foo feature" This command will save your changes away to the `stash`, and reset your working tree and the index to match the tip of your From 1224679011cf618c0ed51fc16f06334aad3c19d3 Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Thu, 22 Sep 2011 08:05:09 -0700 Subject: [PATCH 3/3] oops. cname goes here --- script/publish.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/publish.rb b/script/publish.rb index 827626d9..4117629f 100644 --- a/script/publish.rb +++ b/script/publish.rb @@ -1,5 +1,5 @@ task :publish do - File.open("output/CNAME", 'w+') do |f| + File.open("output/book/CNAME", 'w+') do |f| f.puts("book.git-scm.com") end