diff options
author | Benjamin Fleischer <github@benjaminfleischer.com> | 2013-06-27 23:18:30 -0500 |
---|---|---|
committer | Benjamin Fleischer <github@benjaminfleischer.com> | 2014-07-25 13:41:18 -0500 |
commit | 91d199259bc7a85763d487a1d0fbf8cd50fe29a0 (patch) | |
tree | 5ba172f9798dbc8e6b0edce7dd49436eb818ddef /actionpack | |
parent | 3cbeb8d8eaf217f8eb38f5ea26f766f5cd978ff3 (diff) | |
download | rails-91d199259bc7a85763d487a1d0fbf8cd50fe29a0.tar.gz rails-91d199259bc7a85763d487a1d0fbf8cd50fe29a0.tar.bz2 rails-91d199259bc7a85763d487a1d0fbf8cd50fe29a0.zip |
Encapsulate rake lines from ActiveRecord/ActionPack as CodeTools::LineStatistics
[ci skip]
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/Rakefile | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile index 7eab972595..d12213a2d8 100644 --- a/actionpack/Rakefile +++ b/actionpack/Rakefile @@ -40,27 +40,9 @@ task :release => :package do end task :lines do - lines, codelines, total_lines, total_codelines = 0, 0, 0, 0 - - FileList["lib/**/*.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/**/*.rb"] + CodeTools::LineStatistics.new(files).print_loc end rule '.rb' => '.y' do |t| |