a pastebin project

Paste Description for Git

requires FasterCSV, run in your source directory

Git

  1. require 'fastercsv'
  2.  
  3. h = Hash.new
  4. linen = 0
  5. dategroup = Date.new
  6. #.select{ |l| l =~ /[a-zA-Z0-9]+/ }
  7. `git log --pretty=format:%aD --shortstat | grep [a-zA-Z0-9]`.each { |line|
  8.         if line =~ /\d\d:\d\d:\d\d/ then
  9.                 date = Date.parse(line)
  10.                 dategroup = Date.new(date.year, date.month, 1)
  11.                 if h[dategroup] then
  12.                         h[dategroup][:commits] += 1
  13.                 else
  14.                         h[dategroup] = Hash.new
  15.                         h[dategroup][:commits] = 1
  16.                 end
  17.         else
  18.                 line =~ /([\d]+) files changed, ([\d]+) insertions\(\+\), ([\d]+) deletions\(-\)/
  19.                 h[dategroup][:insert] = (h[dategroup][:insert])? h[dategroup][:insert].to_i + $2.to_i : $2.to_i
  20.                 h[dategroup][:delete] = (h[dategroup][:delete])? h[dategroup][:delete].to_i + $3.to_i : $3.to_i
  21.         end
  22. }
  23.  
  24. FasterCSV.open("/tmp/count.csv", "w") do |csv|
  25.         h.sort.each { |date, value|
  26.                 csv << [ "#{date.month}/1/#{date.year}", value[:commits], value[:insert] + value[:delete] ]
  27.         }
  28. end

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords.

worth-right
fantasy-obligation