Created
April 27, 2012 20:41
-
-
Save rbrooks/2512905 to your computer and use it in GitHub Desktop.
Changelog Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Changelog Generator | |
# Right now, this is date-based. | |
# TODO: Changelog between two Tags, eg: --tags=1.0.0..1.0.1 | |
from_date = ARGV[0] | |
cmd = `git log --no-merges --since='#{from_date}' --pretty='format:%ci::%an <%ae>::%s'`.split /\n/ | |
list = {} | |
list_order = [] | |
cmd.each do |l| | |
date, author, subject = l.chomp.split('::') | |
date, time, zone = date.split(' ') | |
id = "#{date}" | |
if not list[id] | |
list[id] = [] | |
list_order << { :id => id, :value => list[id] } | |
end | |
list[id] << subject | |
end | |
File.open('CHANGELOG', 'w+') do |f| | |
list_order.each do |changelog| | |
id = changelog[:id] | |
value = changelog[:value] | |
f.puts "#{id}" | |
f.puts value.map { |e| " * #{e}" }.join("\n") | |
f.puts "\n" | |
end | |
f.puts "Generated: #{Time.now}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment