aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactionpack/Rakefile24
-rwxr-xr-xactiverecord/Rakefile24
2 files changed, 48 insertions, 0 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index dbfaca4ded..aadcbe5eb2 100755
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -80,6 +80,30 @@ Rake::GemPackageTask.new(spec) do |p|
p.need_zip = true
end
+task :lines do
+ lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
+
+ for file_name in FileList["lib/**/*.rb"]
+ 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
+ end
+
+ puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
+end
+
# Publishing ------------------------------------------------------
diff --git a/activerecord/Rakefile b/activerecord/Rakefile
index 93c4bbbefb..b566d79cf7 100755
--- a/activerecord/Rakefile
+++ b/activerecord/Rakefile
@@ -101,6 +101,30 @@ Rake::GemPackageTask.new(spec) do |p|
p.need_zip = true
end
+task :lines do
+ lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
+
+ for file_name in FileList["lib/active_record/**/*.rb"]
+ 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
+ end
+
+ puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
+end
+
# Publishing ------------------------------------------------------