File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11require 'nanoc3/tasks'
22
3- desc "compile and copy output to ../developer.github.pages"
43task :publish => [ :clean ] do
54 sh "nanoc compile"
6- sh "cp -r output/ ../developer.github.pages"
5+
6+ # this should not be necessary, but I can't figure out how to
7+ # just keep a goddamn static file in the root with nanoc
8+ File . open ( "output/CNAME" , 'w+' ) do |f |
9+ f . puts ( "developer.github.com" )
10+ end
11+
12+ ENV [ 'GIT_DIR' ] = File . expand_path ( `git rev-parse --git-dir` . chomp )
13+ old_sha = `git rev-parse refs/remotes/origin/gh-pages` . chomp
14+ Dir . chdir ( 'output' ) do
15+ ENV [ 'GIT_INDEX_FILE' ] = gif = '/tmp/dev.gh.i'
16+ ENV [ 'GIT_WORK_TREE' ] = Dir . pwd
17+ File . unlink ( gif ) if File . file? ( gif )
18+ `git add -A`
19+ tsha = `git write-tree` . strip
20+ puts "Created tree #{ tsha } "
21+ if old_sha . size == 40
22+ csha = `echo 'boom' | git commit-tree #{ tsha } -p #{ old_sha } ` . strip
23+ else
24+ csha = `echo 'boom' | git commit-tree #{ tsha } ` . strip
25+ end
26+ puts "Created commit #{ csha } "
27+ puts `git show #{ csha } --stat`
28+ puts "Updating gh-pages from #{ old_sha } "
29+ `git update-ref refs/heads/gh-pages #{ csha } `
30+ `git push origin gh-pages`
31+ end
732end
You can’t perform that action at this time.
0 commit comments