Sha256: 8df89803881982998c3a3ded449b3e99fe22e707e0861c88703ff013a6a4e62b

Contents?: true

Size: 551 Bytes

Versions: 6

Compression:

Stored size: 551 Bytes

Contents

desc 'Show some stats about the code'
task :stats do
  line_count = proc do |path|
    Dir[path].collect { |f| File.open(f).readlines.reject { |l| l =~ /(^\s*(\#|\/\*))|^\s*$/ }.size }.inject(0){ |sum,n| sum += n }
  end
  lib = line_count['lib/**/*.rb']
  ext = line_count['ext/**/*.{c,h}'] 
  spec = line_count['spec/**/*.rb']
  ratio = '%1.2f' % (spec.to_f / lib.to_f)
  
  puts "#{lib.to_s.rjust(6)} LOC of lib"
  puts "#{ext.to_s.rjust(6)} LOC of ext"
  puts "#{spec.to_s.rjust(6)} LOC of spec"
  puts "#{ratio.to_s.rjust(6)} ratio lib/spec"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thin-0.6.0-x86-mswin32-60 tasks/stats.rake
thin-0.6.2 tasks/stats.rake
thin-0.6.1-x86-mswin32-60 tasks/stats.rake
thin-0.6.1 tasks/stats.rake
thin-0.6.0 tasks/stats.rake
thin-0.6.2-x86-mswin32-60 tasks/stats.rake