Permalink
Browse files

Fixed the stats generator to not crash when blank lines appear in the…

… output of 'rake stats'. One reason this occurs is if there are deprecation warnings.
  • Loading branch information...
1 parent bcc93d6 commit 8bfefed0f28d18abc1877a48d97495fd266544c9 Casey Howard committed Feb 11, 2011
Showing with 12 additions and 3 deletions.
  1. +1 −2 lib/generators/stats.rb
  2. +11 −1 spec/generators/stats_spec.rb
View
@@ -26,8 +26,7 @@ def to_h
def remove_noise(output)
lines = output.split("\n")
- lines = lines.find_all {|line| line[0].chr != "+" }
- lines = lines.find_all {|line| line[0].chr != "(" }
+ lines.reject! { |line| line.empty? || ['+', '('].include?(line[0].chr) }
lines.shift
lines
end
@@ -13,7 +13,17 @@
describe "analyze method" do
before :each do
- @lines = <<-HERE.gsub(/^\s*/, "")
+ @lines = <<-HERE
+ The 'run' provides a unified access point for all the default Rails' commands.
+
+ Usage: ./script/run <command> [OPTIONS]
+
+ Examples:
+ ./script/run generate controller Admin
+ ./script/run process reaper
+
+ Choose: about, console, dbconsole, destroy, generate, plugin, runner, server, update
+
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+

0 comments on commit 8bfefed

Please sign in to comment.