Sha256: ff72a09c401d0df25a7b6b6789dc7d11ef4252c800e1499f3d36afdbc297c0c4

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

namespace :metric do
  desc 'committed changes per file according to git'
  task 'changes' do
    $stdout.sync = true
    out = lambda{|changes, rb| puts("%4d %s" % [changes, rb]) }
    changes = {}

    print 'counting changes '

    Dir.glob 'lib/**/*.rb' do |rb|
      count = `git log --pretty=oneline '#{rb}'`.count("\n")
      print '.'
      # out[changes, rb]
      changes[rb] = count
    end
    puts ' done.'

    sorted = changes.sort_by{|r,c| c }.reverse

    top = sorted.first(20)
    unless top.empty?
      puts "Top 20:"
      top.each{|(r,c)| out[c,r] }
    end

    bottom = sorted.last(20) - top
    unless bottom.empty?
      puts "Bottom 20:"
      bottom.each{|(r,c)| out[c,r] }
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
manveru-makura-2009.05.27 tasks/metric_changes.rake
makura-2009.05.27 tasks/metric_changes.rake