Sha256: e5c809bda9302ec6818f235f51970972d1506409fe3b3c7e86a694502435da45

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

namespace :metric do

  desc "project statistics"
  task "stat" do
    puts "All:"
    stat_files Dir.glob("**/*.{rb,slim,coffee,scss}")
    puts "\nRuby:"
    stat_files Dir.glob("**/*.rb") - Dir.glob("test/**/*.rb")
  end
end

private

def stat_files fs
  c = 0
  fc = 0
  total_size = 0.0
  fs.each do |f|
    fc += 1
    data = File.binread f
    c += data.count "\n"
    total_size += data.bytesize
  end
  puts "files: #{fc}"
  puts "lines: #{c}"
  puts "chars: #{total_size.to_i}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simba-0.8.0 template/lib/tasks/stat.rake