Sha256: be998dc662111866326636beffaee0c509ce438caab0f553bdeafd8174b830d4

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

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

    print 'churning '

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

    sorted = churn.sort_by{|r,c| c }.reverse
    puts "Top 20:"
    sorted.first(20).each{|(r,c)| out[c,r] }
    puts "Bottom 20:"
    sorted.last(20).each{|(r,c)| out[c,r] }
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.02 rake_tasks/metric.rake
ptomato-ramaze-2009.02.1 rake_tasks/metric.rake
ptomato-ramaze-2009.02 rake_tasks/metric.rake
ramaze-2009.03 rake_tasks/metric.rake