21200: copied branch from arvados-workbench2 Arvados-DCO-1.1-Signed-off-by: Lisa...
[arvados.git] / sdk / ruby-google-api-client / rakelib / metrics.rake
1 namespace :metrics do
2   task :lines do
3     lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
4     for file_name in FileList['lib/**/*.rb']
5       f = File.open(file_name)
6       while line = f.gets
7         lines += 1
8         next if line =~ /^\s*$/
9         next if line =~ /^\s*#/
10         codelines += 1
11       end
12       puts "L: #{sprintf('%4d', lines)}, " +
13         "LOC #{sprintf('%4d', codelines)} | #{file_name}"
14       total_lines     += lines
15       total_codelines += codelines
16
17       lines, codelines = 0, 0
18     end
19
20     puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
21   end
22 end