diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-17 22:12:23 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-17 22:12:23 -0300 |
commit | eced6f81184a67fc47ecb78e802d82a7234ae23d (patch) | |
tree | c0803bdbfe00c423e6cbf40f091a16a3134f4820 /activerecord | |
parent | 6e6ebeb03cf0ff58c9ef778bfbdd9b0b9891b17b (diff) | |
parent | 91d199259bc7a85763d487a1d0fbf8cd50fe29a0 (diff) | |
download | rails-eced6f81184a67fc47ecb78e802d82a7234ae23d.tar.gz rails-eced6f81184a67fc47ecb78e802d82a7234ae23d.tar.bz2 rails-eced6f81184a67fc47ecb78e802d82a7234ae23d.zip |
Merge pull request #16294 from bf4/code_tools
Update, unify, encapsulate, and fix various code tools in Rails
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/Rakefile | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 7769966a22..b1069e5dcc 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -146,27 +146,9 @@ task :drop_postgresql_databases => 'db:postgresql:drop' task :rebuild_postgresql_databases => 'db:postgresql:rebuild' task :lines do - lines, codelines, total_lines, total_codelines = 0, 0, 0, 0 - - FileList["lib/active_record/**/*.rb"].each do |file_name| - next if file_name =~ /vendor/ - File.open(file_name, 'r') do |f| - while line = f.gets - lines += 1 - next if line =~ /^\s*$/ - next if line =~ /^\s*#/ - codelines += 1 - end - 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}" + load File.expand_path('..', File.dirname(__FILE__)) + '/tools/line_statistics' + files = FileList["lib/active_record/**/*.rb"] + CodeTools::LineStatistics.new(files).print_loc end spec = eval(File.read('activerecord.gemspec')) |