@@ -39,26 +39,21 @@ task :publish, [:no_commit_msg] => [:clean, :remove_output_dir] do |t, args|
3939 mesg = commit_message ( args [ :no_commit_msg ] )
4040 sh "nanoc compile"
4141
42- # save precious files
43- `git checkout gh-pages`
44- tmpdir = Dir . mktmpdir
45- FileUtils . cp_r ( "enterprise" , tmpdir )
46- FileUtils . cp ( "robots.txt" , tmpdir )
47- `git checkout master`
48-
4942 ENV [ 'GIT_DIR' ] = File . expand_path ( `git rev-parse --git-dir` . chomp )
5043 ENV [ 'RUBYOPT' ] = nil
5144 old_sha = `git rev-parse refs/remotes/origin/gh-pages` . chomp
5245 Dir . chdir ( 'output' ) do
5346 ENV [ 'GIT_INDEX_FILE' ] = gif = '/tmp/dev.gh.i'
5447 ENV [ 'GIT_WORK_TREE' ] = Dir . pwd
5548 File . unlink ( gif ) if File . file? ( gif )
56- # restore precious files
57- FileUtils . cp_r ( Dir . glob ( "#{ tmpdir } /**/*" ) , "." )
5849 `git add -A`
5950 tsha = `git write-tree` . strip
6051 puts "Created tree #{ tsha } "
61- if old_sha . size == 40
52+ # Heroku runs git@1.7, we don't have the luxury of -m
53+ if ENV [ 'IS_HEROKU' ]
54+ `echo #{ mesg } > changelog`
55+ csha = `git commit-tree #{ tsha } -p #{ old_sha } < changelog` . strip
56+ elsif old_sha . size == 40
6257 csha = `git commit-tree #{ tsha } -p #{ old_sha } -m '#{ mesg } '` . strip
6358 else
6459 csha = `git commit-tree #{ tsha } -m '#{ mesg } '` . strip
@@ -67,6 +62,6 @@ task :publish, [:no_commit_msg] => [:clean, :remove_output_dir] do |t, args|
6762 puts `git show #{ csha } --stat`
6863 puts "Updating gh-pages from #{ old_sha } "
6964 `git update-ref refs/heads/gh-pages #{ csha } `
70- # `git push origin gh-pages`
65+ `git push origin gh-pages`
7166 end
7267end
0 commit comments