Sha256: 89c3632867201910b0d5d5dfa2c84fa883d58d3aea22fe20de8b51d6c359f2de

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

desc "Prints lines of code metrics"
task :stats do
  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0

  FileList["lib/keymap/**/*.rb"].each { |file_name|
    next if file_name =~ /vendor/
    f = File.open(file_name)

    while (line = f.gets)
      lines += 1
      next if line =~ /^\s*$/
      next if line =~ /^\s*#/
      codelines += 1
    end
    puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"

    total_lines += lines
    total_codelines += codelines

    lines, codelines = 0, 0
  }

  puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
keymap-0.3.2 tasks/stats.rb
keymap-0.3.1 tasks/stats.rb