travis: run coveralls in verbose mode
[luajson.git] / util / processShortlog.lua
blob414919880239214aed2fe154d7322c9b868e6e68
1 #!/usr/bin/env lua
2 local io = require("io")
3 local table = require("table")
4 local authors = {}
6 local currentAuthor
8 local function pushValue(t, group, value)
9 local items = t[group] or {}
10 t[group] = items
11 items[#items + 1] = value
12 end
13 for line in io.lines() do
14 local author = line:match("^(.- %(%d*%):)$")
15 line = line:match("^%s*(.-)%s*$")
16 if author then
17 currentAuthor = authors[author] or {}
18 authors[author] = currentAuthor
19 elseif currentAuthor and #line > 0 then
20 local msg = line:gsub("^%s*","")
21 local group, data = msg:match("^([^:]*[%s]*:)[%s]*(.*)$")
22 if not group then
23 pushValue(currentAuthor, "-ungrouped-", msg)
24 else
25 pushValue(currentAuthor, group, data)
26 end
27 end
28 end
29 for author, groups in pairs(authors) do
30 print(author)
31 -- SORT GROUPS
32 local sorted = {}
33 for group, groupValues in pairs(groups) do
34 sorted[#sorted + 1] = {group, groupValues}
35 end
36 table.sort(sorted, function(a,b) return a[1] < b[1] end)
37 for _, gv in ipairs(sorted) do
38 local group, groupValues = unpack(gv)
39 print("\t" .. group)
40 for _, entry in ipairs(groupValues) do
41 print("\t\t" .. entry)
42 end
43 end
44 end