class MetricFu::RcovGenerator

Public Class Methods

metric() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 10
def self.metric
  :rcov
end

Public Instance Methods

analyze() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 43
def analyze
  rcov_text = load_output
  formatter = MetricFu::RCovFormatCoverage.new(rcov_text)
  @rcov = formatter.to_h
end
command() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 22
def command
  @command ||= default_command
end
command=(command) click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 26
def command=(command)
  @command = command
end
default_command() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 35
def default_command
  require "rake"
  reset_output_location
  test_files = FileList[*options[:test_files]].join(" ")
  rcov_opts = options[:rcov_opts].join(" ")
  %(RAILS_ENV=#{options[:environment]} rcov #{test_files} #{rcov_opts} >> #{default_output_file})
end
emit() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 14
def emit
  if run_rcov?
    mf_debug "** Running the specs/tests in the [#{options[:environment]}] environment"
    mf_debug "** #{command}"
    `#{command}`
  end
end
reset_output_location() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 30
def reset_output_location
  MetricFu::Utility.rm_rf(metric_directory, verbose: false)
  MetricFu::Utility.mkdir_p(metric_directory)
end
to_h() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 49
def to_h
  {
    rcov: @rcov
  }
end

Private Instance Methods

default_output_file() click to toggle source

Only used if run_rcov? is true

# File lib/metric_fu/metrics/rcov/generator.rb, line 71
def default_output_file
  output_file || File.join(metric_directory, "rcov.txt")
end
load_output() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 62
def load_output
  MetricFu::RCovTestCoverageClient.new(output_file).load
end
output_file() click to toggle source
# File lib/metric_fu/metrics/rcov/generator.rb, line 66
def output_file
  options.fetch(:external)
end
run_rcov?() click to toggle source

We never run rcov anymore

# File lib/metric_fu/metrics/rcov/generator.rb, line 58
def run_rcov?
  false
end