Class: MetricFu::Churn

Inherits:
Generator show all
Defined in:
lib/generators/churn.rb

Instance Attribute Summary

Attributes inherited from Generator

#report, #template

Instance Method Summary collapse

Methods inherited from Generator

class_name, #create_data_dir_if_missing, #create_metric_dir_if_missing, #create_output_dir_if_missing, generate_report, #generate_report, metric_directory, #metric_directory, #remove_excluded_files, #round_to_tenths, #to_graph

Constructor Details

#initialize(options = {}) ⇒ Churn

Returns a new instance of Churn.



5
6
7
# File 'lib/generators/churn.rb', line 5

def initialize(options={})
  super
end

Instance Method Details

#analyzeObject



15
16
17
18
19
20
21
# File 'lib/generators/churn.rb', line 15

def analyze
  if @output.match(/Churning requires a subversion or git repo/)
    @churn = [:churn => {}]
  else
    @churn = YAML::load(@output)
  end
end

#emitObject



9
10
11
12
13
# File 'lib/generators/churn.rb', line 9

def emit
  @output = `churn --yaml`
  yaml_start = @output.index("---")
  @output = @output[yaml_start...@output.length] if yaml_start
end

#to_hObject



23
24
25
# File 'lib/generators/churn.rb', line 23

def to_h
  {:churn => @churn[:churn]}
end