aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/Rakefile
diff options
context:
space:
mode:
authorNathan Broadbent <nathan.f77@gmail.com>2012-01-30 01:27:43 +0800
committerNathan Broadbent <nathan.f77@gmail.com>2012-01-30 03:15:51 +0800
commitbf928bc7329640969917eb680da4de959b7156b7 (patch)
tree13d51eda9d6462d73c3f1114621b67961ea41012 /actionpack/Rakefile
parentb31eac56097a0bfc5f5af70de91ad261067a395f (diff)
downloadrails-bf928bc7329640969917eb680da4de959b7156b7.tar.gz
rails-bf928bc7329640969917eb680da4de959b7156b7.tar.bz2
rails-bf928bc7329640969917eb680da4de959b7156b7.zip
Use block form of 'File.open' so that File object is auto closed at end
Diffstat (limited to 'actionpack/Rakefile')
-rwxr-xr-xactionpack/Rakefile14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index 75d16ceb05..bb1e704767 100755
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -57,13 +57,13 @@ task :lines do
FileList["lib/**/*.rb"].each do |file_name|
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
+ 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}"