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

#generate_html, #generate_report, generate_report, #link_to_filename, #save_html, #template_file

Constructor Details

#initialize(base_dir, options = {}) ⇒ Churn

Returns a new instance of Churn.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/metric_fu/churn.rb', line 4

def initialize(base_dir, options={})
  @base_dir = base_dir
  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



17
18
19
# File 'lib/metric_fu/churn.rb', line 17

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

#template_nameObject

should be dynamically read from the class



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

def template_name
  'churn'
end