Class: MetricFu::Roodi
Instance Attribute Summary
Attributes inherited from Generator
#report, #template
Instance Method Summary
collapse
Methods inherited from Generator
class_name, #create_metric_dir_if_missing, #create_output_dir_if_missing, generate_report, #generate_report, #initialize, metric_directory, #metric_directory, #round_to_tenths
Instance Method Details
#analyze ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/generators/roodi.rb', line 8
def analyze
@matches = @output.chomp.split("\n").map{|m| m.split(" - ") }
total = @matches.pop
@matches.reject! {|array| array.empty? }
@matches.map! do |match|
file, line = match[0].split(':')
problem = match[1]
{:file => file, :line => line, :problem => problem}
end
@roodi_results = {:total => total, :problems => @matches}
end
|
#emit ⇒ Object
3
4
5
6
|
# File 'lib/generators/roodi.rb', line 3
def emit
files_to_analyze = MetricFu.roodi[:dirs_to_roodi].map{|dir| Dir[File.join(dir, "**/*.rb")] }
@output = `roodi #{files_to_analyze.join(" ")}`
end
|
#to_h ⇒ Object
20
21
22
|
# File 'lib/generators/roodi.rb', line 20
def to_h
{:roodi => @roodi_results}
end
|