Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (35 sloc) 1.19 kb
6d272a6 @tclem Move repo forks, update responses, fix a few issues
tclem authored
1 require 'nanoc3/tasks'
2
ecbcc8e @tclem Move static resources around, adding new datasource to handle them
tclem authored
3 desc "Compile the site"
4 task :compile do
5 `nanoc compile`
6 end
7
f6126de @tmm1 show rake publish in rake -T
tmm1 authored
8 desc "Publish to http://developer.github.com"
6d272a6 @tclem Move repo forks, update responses, fix a few issues
tclem authored
9 task :publish => [:clean] do
736dce9 @tclem Check for dir before removing
tclem authored
10 FileUtils.rm_r('output') if File.exist?('output')
3a850ce @schacon remove the output directory, punk
schacon authored
11
6d272a6 @tclem Move repo forks, update responses, fix a few issues
tclem authored
12 sh "nanoc compile"
e76fe0c @schacon Rake task to update gh-pages without having another checkout
schacon authored
13
14 # this should not be necessary, but I can't figure out how to
15 # just keep a goddamn static file in the root with nanoc
16 File.open("output/CNAME", 'w+') do |f|
17 f.puts("developer.github.com")
18 end
19
20 ENV['GIT_DIR'] = File.expand_path(`git rev-parse --git-dir`.chomp)
21 old_sha = `git rev-parse refs/remotes/origin/gh-pages`.chomp
22 Dir.chdir('output') do
23 ENV['GIT_INDEX_FILE'] = gif = '/tmp/dev.gh.i'
24 ENV['GIT_WORK_TREE'] = Dir.pwd
25 File.unlink(gif) if File.file?(gif)
26 `git add -A`
27 tsha = `git write-tree`.strip
28 puts "Created tree #{tsha}"
29 if old_sha.size == 40
30 csha = `echo 'boom' | git commit-tree #{tsha} -p #{old_sha}`.strip
31 else
32 csha = `echo 'boom' | git commit-tree #{tsha}`.strip
33 end
34 puts "Created commit #{csha}"
35 puts `git show #{csha} --stat`
36 puts "Updating gh-pages from #{old_sha}"
37 `git update-ref refs/heads/gh-pages #{csha}`
38 `git push origin gh-pages`
39 end
6d272a6 @tclem Move repo forks, update responses, fix a few issues
tclem authored
40 end
Something went wrong with that request. Please try again.