From c2d9d969f95d4abc989131a6b15dce59faff5cff Mon Sep 17 00:00:00 2001 From: Rick Bradley Date: Sat, 8 Dec 2012 15:06:45 -0600 Subject: [PATCH 1/3] Make a more useful commit message when publishing The message generation seems to work, but haven't tried pushing it through the actual publishing pipeline yet. /cc @pengwynn --- Rakefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index e936202c3a..dcf0dd24b3 100644 --- a/Rakefile +++ b/Rakefile @@ -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" @@ -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` From 8d10df48973786234793ce58cc5d2e8b8809b56e Mon Sep 17 00:00:00 2001 From: Rick Bradley Date: Sat, 8 Dec 2012 15:28:43 -0600 Subject: [PATCH 2/3] whitespace change to test rake publish changes --- ...12-12-08-finding-source-and-fork-repos-for-organizations.html | 1 + 1 file changed, 1 insertion(+) diff --git a/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html b/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html index fb3f45caab..c6af80d2c4 100644 --- a/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html +++ b/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html @@ -20,3 +20,4 @@ Check out the docs for sorting and filtering options: * [Organization Repositories](/v3/repos/#list-organization-repositories) + From 9e63c751cc6e5fc735874567b07a93991a8fae09 Mon Sep 17 00:00:00 2001 From: Rick Bradley Date: Sat, 8 Dec 2012 15:29:30 -0600 Subject: [PATCH 3/3] add a ' to message prompt --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index dcf0dd24b3..437e5d3d09 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,7 @@ 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}): " + print "Enter a commit message (default: '#{last_commit}'): " STDOUT.flush mesg = STDIN.gets.chomp.strip