improve output of the release_note:generates rake task

This commit is contained in:
Régis Hanol 2014-10-02 19:18:07 +02:00
parent 28cbebe5ed
commit b58435de90

View File

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