Sha256: c73539001ffd505d4c18dc3e01c6c4be1516f24dc89b133beea18a6bd3287ebb

Contents?: true

Size: 603 Bytes

Versions: 189

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

189 entries across 162 versions & 37 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/uuidtools-2.1.2/tasks/metrics.rake
addressable-2.2.7 tasks/metrics.rake
abiquo-etk-0.5.8 vendor/addressable-2.2.1/tasks/metrics.rake
httpadapter-1.0.1 tasks/metrics.rake
sidekick-client-0.2.5 lib/ext/uuidtools-2.1.1/tasks/metrics.rake
vanity-1.7.1 vendor/ruby/1.9.1/gems/addressable-2.2.6/tasks/metrics.rake
addressable-2.2.6 tasks/metrics.rake
abiquo-etk-0.5.3 vendor/addressable-2.2.1/tasks/metrics.rake
addressable-2.2.5 tasks/metrics.rake
cerberus-0.8.0 lib/vendor/addressable/tasks/metrics.rake
honkster-addressable-2.2.3 tasks/metrics.rake
httpadapter-1.0.0 tasks/metrics.rake
abiquo-etk-0.4.42 vendor/addressable-2.2.1/tasks/metrics.rake
fields-addressable-2.2.3.1 tasks/metrics.rake
uuidtools-2.1.2 tasks/metrics.rake
addressable-2.2.4 tasks/metrics.rake
cerberus-0.7.9 lib/vendor/addressable/tasks/metrics.rake
addressable-2.2.3 tasks/metrics.rake
httpadapter-0.2.1 tasks/metrics.rake
abiquo-etk-0.4.33 vendor/addressable-2.2.1/tasks/metrics.rake