Skip to content

Commit

Permalink
improve rake authors
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Jun 5, 2011
1 parent f24ddd4 commit e014871
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Rakefile
Expand Up @@ -90,18 +90,22 @@ task :thanks, [:release,:backports] do |t, a|
"(based on commits included in #{a.release}, but not in #{a.backports})" "(based on commits included in #{a.release}, but not in #{a.backports})"
end end


task :authors, [:format, :sep] do |t, a| desc "list of authors"
a.with_defaults :format => "%s (%d)", :sep => ', ' task :authors, [:commit_range, :format, :sep] do |t, a|
a.with_defaults :format => "%s (%d)", :sep => ", "
authors = Hash.new { |h,k| h[k] = 0 } authors = Hash.new { |h,k| h[k] = 0 }
blake = "Blake Mizerany" blake = "Blake Mizerany"
overall = 0
mapping = { mapping = {
"blake.mizerany@gmail.com" => blake, "bmizerany" => blake, "blake.mizerany@gmail.com" => blake, "bmizerany" => blake,
"a_user@mac.com" => blake, "ichverstehe" => "Harry Vangberg", "a_user@mac.com" => blake, "ichverstehe" => "Harry Vangberg",
"Wu Jiang (nouse)" => "Wu Jiang" } "Wu Jiang (nouse)" => "Wu Jiang" }
`git shortlog -s`.lines.map do |line| `git shortlog -s #{a.commit_range}`.lines.map do |line|
num, name = line.split("\t", 2).map(&:strip) num, name = line.split("\t", 2).map(&:strip)
authors[mapping[name] || name] += num.to_i authors[mapping[name] || name] += num.to_i
overall += num.to_i
end end
puts "#{overall} commits by #{authors.count} authors:"
puts authors.sort_by { |n,c| -c }.map { |e| a.format % e }.join(a.sep) puts authors.sort_by { |n,c| -c }.map { |e| a.format % e }.join(a.sep)
end end


Expand Down

0 comments on commit e014871

Please sign in to comment.