Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 8bfefed0f28d18abc1877a48d97495fd266544c9 1 parent bcc93d6
Casey Howard authored
Showing with 12 additions and 3 deletions.
  1. +1 −2  lib/generators/stats.rb
  2. +11 −1 spec/generators/stats_spec.rb
View
3  lib/generators/stats.rb
@@ -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
View
12 spec/generators/stats_spec.rb
@@ -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 |
+----------------------+-------+-------+---------+---------+-----+-------+
Please sign in to comment.
Something went wrong with that request. Please try again.