Class: MetricFu::Churn

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

Defined Under Namespace

Classes: Git, SourceControl, Svn

Instance Method Summary collapse

Methods inherited from Base::Generator

#cycle, #generate_html, generate_report, #generate_report, #inline_css, #link_to_filename, metric_dir, #save_html, #template_file, #template_name, template_name

Constructor Details

#initialize(options = {}) ⇒ Churn

Returns a new instance of Churn.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/metric_fu/churn.rb', line 10

def initialize(options={})
  @base_dir = File.join(MetricFu::BASE_DIRECTORY, template_name)
  if File.exist?(".git")
    @source_control = Git.new(options[:start_date])
  elsif File.exist?(".svn")
    @source_control = Svn.new(options[:start_date])
  else
    raise "Churning requires a subversion or git repo"
  end

  @minimum_churn_count = options[:minimum_churn_count] || 5
end

Instance Method Details

#analyzeObject



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

def analyze
  @changes = parse_log_for_changes.reject! {|file, change_count| change_count < @minimum_churn_count}
end