Skip to content
This repository was archived by the owner on Nov 1, 2017. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,23 @@ task :compile do
`nanoc compile`
end

# prompt user for a commit message; default: HEAD commit 1-liner
def commit_message
last_commit = `git log -1 --pretty=format:"%s"`.chomp.strip
last_commit = 'Publishing developer content to GitHub pages.' if last_commit == ''

print "Enter a commit message (default: '#{last_commit}'): "
STDOUT.flush
mesg = STDIN.gets.chomp.strip

mesg = last_commit if mesg == ''
mesg.gsub(/'/, '') # to allow this to be handed off via -m '#{message}'
end

desc "Publish to http://developer.github.com"
task :publish => [:clean] do
mesg = commit_message

FileUtils.rm_r('output') if File.exist?('output')

sh "nanoc compile"
Expand All @@ -21,9 +36,9 @@ task :publish => [:clean] do
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
csha = `git commit-tree #{tsha} -p #{old_sha} -m '#{mesg}'`.strip
else
csha = `echo 'boom' | git commit-tree #{tsha}`.strip
csha = `git commit-tree #{tsha} -m '#{mesg}'`.strip
end
puts "Created commit #{csha}"
puts `git show #{csha} --stat`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
Check out the docs for sorting and filtering options:

* [Organization Repositories](/v3/repos/#list-organization-repositories)