2014-10-03 01:01:10 +08:00
|
|
|
desc "generate a release note from the important commits"
|
|
|
|
task "release_note:generate", :tag do |t, args|
|
|
|
|
tag = args[:tag] || `git describe --tags --abbrev=0`.strip
|
|
|
|
|
2014-10-03 01:18:07 +08:00
|
|
|
bug_fixes = Set.new
|
|
|
|
new_features = Set.new
|
|
|
|
ux_changes = Set.new
|
2014-10-03 01:01:10 +08:00
|
|
|
|
|
|
|
`git log --pretty=format:%s #{tag}..HEAD`.each_line do |line|
|
|
|
|
if line =~ /^(FIX|BUG|BUGFIX):/i
|
2014-10-03 01:18:07 +08:00
|
|
|
bug_fixes << better(line)
|
2014-10-03 01:01:10 +08:00
|
|
|
elsif line =~ /^FEATURE:/i
|
2014-10-03 01:18:07 +08:00
|
|
|
new_features << better(line)
|
2014-10-03 01:01:10 +08:00
|
|
|
elsif line =~ /^UX:/i
|
2014-10-03 01:18:07 +08:00
|
|
|
ux_changes << better(line)
|
2014-10-03 01:01:10 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-03 01:18:07 +08:00
|
|
|
puts "NEW FEATURES:", new_features.to_a, ""
|
|
|
|
puts "BUG FIXES:", bug_fixes.to_a, ""
|
|
|
|
puts "UX CHANGES:", ux_changes.to_a, ""
|
2014-10-03 01:01:10 +08:00
|
|
|
|
|
|
|
end
|
2014-10-03 01:18:07 +08:00
|
|
|
|
|
|
|
def better(line)
|
|
|
|
line = line.gsub(/^(FIX|BUG|BUGFIX|FEATURE|UX):/i, "").strip
|
|
|
|
line[0] = line[0].capitalize
|
|
|
|
line
|
|
|
|
end
|