class Kolekti::Collector

Attributes

description[R]
name[R]
supported_metrics[R]

Public Class Methods

available?() click to toggle source
# File lib/kolekti/collector.rb, line 16
def self.available?; raise NotImplementedError; end
new(name, description, supported_metrics) click to toggle source
# File lib/kolekti/collector.rb, line 18
def initialize(name, description, supported_metrics)
  @name = name
  @description = description
  @supported_metrics = supported_metrics
end
run_if_available(command) click to toggle source
# File lib/kolekti/collector.rb, line 8
def self.run_if_available(command)
  begin
    `#{command}`
  rescue SystemCallError
    nil
  end
end

Public Instance Methods

clean(code_directory, wanted_metric_configurations) click to toggle source
# File lib/kolekti/collector.rb, line 26
def clean(code_directory, wanted_metric_configurations); raise NotImplementedError; end
collect_metrics(code_directory, wanted_metric_configurations, persistence_strategy) click to toggle source
# File lib/kolekti/collector.rb, line 24
def collect_metrics(code_directory, wanted_metric_configurations, persistence_strategy); raise NotImplementedError; end
default_value_from(metric_configuration) click to toggle source
# File lib/kolekti/collector.rb, line 28
def default_value_from(metric_configuration); raise NotImplementedError; end

Protected Instance Methods

parse_supported_metrics(metrics_path, metric_collector_name, languages) click to toggle source
# File lib/kolekti/collector.rb, line 32
def parse_supported_metrics(metrics_path, metric_collector_name, languages)
  supported_metrics = {}
  YAML.load_file(metrics_path)[:metrics].each do | code, metric |
    if metric[:type] == "NativeMetricSnapshot"
      supported_metrics[code] = KalibroClient::Entities::Miscellaneous::NativeMetric.new(metric[:name], code, metric[:scope], languages, metric_collector_name)
    else
      supported_metrics[code] = KalibroClient::Entities::Miscellaneous::HotspotMetric.new(metric[:name], code, languages, metric_collector_name)
    end
  end
  supported_metrics
end