Parent

MetricFu::RailsBestPractices

Public Class Methods

verify_dependencies!() click to toggle source
# File lib/generators/rails_best_practices.rb, line 4
def self.verify_dependencies!
  `rails_best_practices --help`
  raise 'sudo gem install rails_best_practices # if you want the rails_best_practices tasks' unless $?.success?
end

Public Instance Methods

analyze() click to toggle source
# File lib/generators/rails_best_practices.rb, line 14
def analyze
  @matches = @output.chomp.split("\n").map{|m| m.split(" - ") }
  total = @matches.pop
  2.times { @matches.pop } # ignore wiki link
  @matches.reject! {|array| array.empty? }
  @matches.map! do |match|
    file, line = match[0].split(':')
    problem = match[1]
    {:file => file, :line => line, :problem => problem}
  end
  @rails_best_practices_results = {:total => total, :problems => @matches}
end
emit() click to toggle source
# File lib/generators/rails_best_practices.rb, line 10
def emit
  @output = `rails_best_practices .`
end
to_h() click to toggle source
# File lib/generators/rails_best_practices.rb, line 27
def to_h
  {:rails_best_practices => @rails_best_practices_results}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.