Skip to content

Commit eb1f8c1

Browse files
committed
Merge pull request github#181 from github/improve-boom-message
Make a more useful commit message when publishing
2 parents 91b9643 + 9e63c75 commit eb1f8c1

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

Rakefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,23 @@ task :compile do
55
`nanoc compile`
66
end
77

8+
# prompt user for a commit message; default: HEAD commit 1-liner
9+
def commit_message
10+
last_commit = `git log -1 --pretty=format:"%s"`.chomp.strip
11+
last_commit = 'Publishing developer content to GitHub pages.' if last_commit == ''
12+
13+
print "Enter a commit message (default: '#{last_commit}'): "
14+
STDOUT.flush
15+
mesg = STDIN.gets.chomp.strip
16+
17+
mesg = last_commit if mesg == ''
18+
mesg.gsub(/'/, '') # to allow this to be handed off via -m '#{message}'
19+
end
20+
821
desc "Publish to http://developer.github.com"
922
task :publish => [:clean] do
23+
mesg = commit_message
24+
1025
FileUtils.rm_r('output') if File.exist?('output')
1126

1227
sh "nanoc compile"
@@ -21,9 +36,9 @@ task :publish => [:clean] do
2136
tsha = `git write-tree`.strip
2237
puts "Created tree #{tsha}"
2338
if old_sha.size == 40
24-
csha = `echo 'boom' | git commit-tree #{tsha} -p #{old_sha}`.strip
39+
csha = `git commit-tree #{tsha} -p #{old_sha} -m '#{mesg}'`.strip
2540
else
26-
csha = `echo 'boom' | git commit-tree #{tsha}`.strip
41+
csha = `git commit-tree #{tsha} -m '#{mesg}'`.strip
2742
end
2843
puts "Created commit #{csha}"
2944
puts `git show #{csha} --stat`

content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
Check out the docs for sorting and filtering options:
2121

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

0 commit comments

Comments
 (0)