Fun with Rails' Git Log and glTail

November 08, 2010

I ended up with a little too much free time the other day and was curious to see what would happen if I fed the entire history of Rails' commit history through the visualization tool glTail. Well, it looks like this:



I also did one for Jquery.



If you want to do your own, here are the files you'll need...

#
# Place this file in gltail/lib/gl_tail/parsers/gitlogfu.rb
#
# Parser which handles the output of following 'git log' command.
#
# git log --pretty='format:%ct <%an>' --shortstat -z | tr '\n\0' ' \n' | sort -n
#
class GitLogFuParser < Parser

  def parse(line)
    @yesterday ||= Time.at(0)
    if line =~ /(\d+) <(.*?)>\s+(\d+) files changed, (\d+) insertions..., (\d+) deletions/
      today = Time.at($1.to_i)
      author = $2
      files = $3.to_i
      inserts = $4.to_i
      deletes = $5.to_i

      add_activity(:block => 'insertions', :name => author, :size => inserts) if inserts > 0
      add_activity(:block => 'deletions', :name => author, :size => deletes) if deletes > 0

      add_event(:block => 'insertions', :name => author, :message => today.strftime('%B %d, %Y'), 
                :update_stats => false, :color => [0.4, 0.4, 0.4, 1.0]) if today.day != @yesterday.day && today.wday == 0

      @yesterday = today

    end
  end

end


servers:
    gitlogshort:
        source: local
        files: /Users/philip/Desktop/rails.git.log
        parser: gitlogfu
        color: 0.2, 0.2, 1.0, 1.0
config:
    dimensions: 900x450
    min_blob_size: 0.003
    max_blob_size: 0.04
    highlight_color: white
    bounce: false
    left_column:
        size: 17
        alignment: -0.99
        blocks:
            insertions:
                color: purple
                auto_clean: false
                show: total
    right_column:
        size: 17
        alignment: 0.99
        blocks:
            deletions:
                color: pink
                auto_clean: false
                show: total