Sha256: 651a09a27393d08fccdd24a7912cf49d24bdc8522c0cca60959bc815934ed994

Contents?: true

Size: 603 Bytes

Versions: 46

Compression:

Stored size: 603 Bytes

Contents

namespace :metrics do
  task :lines do
    lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
    for file_name in FileList['lib/**/*.rb']
      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
    end

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

Version data entries

46 entries across 46 versions & 9 rubygems

Version Path
jomz-google-api-client-0.7.1 tasks/metrics.rake
multiterm-0.0.5 tasks/metrics.rake
multiterm-0.0.4 tasks/metrics.rake
multiterm-0.0.2 tasks/metrics.rake
multiterm-0.0.1 tasks/metrics.rake
href-preview-0.1.3 tasks/metrics.rake
href-preview-0.1.2 tasks/metrics.rake
href-preview-0.1.1 tasks/metrics.rake
href-preview-0.1.0 tasks/metrics.rake
google-api-client-0.7.1 tasks/metrics.rake
google-api-client-0.7.0 tasks/metrics.rake
google-api-client-0.7.0.rc2 tasks/metrics.rake
google-api-client-0.6.4 tasks/metrics.rake
google-api-client-0.6.3 tasks/metrics.rake
autoparse-0.3.3 tasks/metrics.rake
google-api-omniauth-0.1.1 tasks/metrics.rake
google-api-client-0.6.2 tasks/metrics.rake
google-api-client-0.6.1 tasks/metrics.rake
google-api-client-0.6.0 tasks/metrics.rake
google-api-client-0.5.0 tasks/metrics.rake