add summary script so i can see progress and authorship
[progit-mk.git] / summary.rb
blob5b43bedcca7f675e3476e4c22d53bc155fd60a66
1 #! /usr/bin/env ruby
4 command = ARGV[0]
5 exclude = ['figures', 'figures-dia', 'figures-source', 'couchapp', 'latex', 'pdf', 'epub', 'en']
7 data = []
8 Dir.glob("*").each do |dir|
9   if !File.file?(dir) && !exclude.include?(dir)
10     lines = `git diff-tree -r -p master:en master:#{dir} | grep '^+' | wc -l`.strip.to_i
11     last_commit = `git log -1 --no-merges --format="%ar" #{dir}`.chomp
12     authors = ""
13     if command == 'authors'
14       authors = `git shortlog --no-merges -s -n #{dir}`.chomp
15     end
16     data << [dir, lines, authors, last_commit]
17   end
18 end
20 d = data.sort { |a, b| b[1] <=> a[1] }
21 d.each do |dir, lines, authors, last|
22   puts "#{dir.ljust(10)} - #{lines} (#{last})"
23   if command == 'authors'
24     puts "Authors: #{authors.split("\n").size}"
25     puts authors 
26     puts
27   end
28 end