Class: Kolekti::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/kolekti/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_path, wanted_metric_configurations, persistence_strategy) ⇒ Runner

Returns a new instance of Runner.



20
21
22
23
24
25
# File 'lib/kolekti/runner.rb', line 20

def initialize(repository_path, wanted_metric_configurations, persistence_strategy)
  @repository_path = repository_path
  @wanted_metric_configurations = wanted_metric_configurations.map { |m| [m.metric.code, m] }.to_h
  @persistence_strategy = persistence_strategy
  @collectors = find_collectors
end

Instance Attribute Details

#collectorsObject (readonly)

Returns the value of attribute collectors.



18
19
20
# File 'lib/kolekti/runner.rb', line 18

def collectors
  @collectors
end

#repository_pathObject (readonly)

Returns the value of attribute repository_path.



18
19
20
# File 'lib/kolekti/runner.rb', line 18

def repository_path
  @repository_path
end

#wanted_metric_configurationsObject (readonly)

Returns the value of attribute wanted_metric_configurations.



18
19
20
# File 'lib/kolekti/runner.rb', line 18

def wanted_metric_configurations
  @wanted_metric_configurations
end

Instance Method Details

#clean_outputObject



33
34
35
36
37
# File 'lib/kolekti/runner.rb', line 33

def clean_output
  @collectors.each do |collector|
    collector.clean(@repository_path, @wanted_metric_configurations)
  end
end

#run_wanted_metricsObject



27
28
29
30
31
# File 'lib/kolekti/runner.rb', line 27

def run_wanted_metrics
  @collectors.each do |collector|
    collector.collect_metrics(@repository_path, @wanted_metric_configurations, @persistence_strategy)
  end
end