Class: MetricFu::RcovGenerator
Instance Attribute Summary
Attributes inherited from Generator
#options, #result, #template
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
#generate_result, generators, get_generator, #initialize, #metric, #metric_config, metric_directory, #metric_directory, not_implemented, #remove_excluded_files, #round_to_tenths, #run!
Class Method Details
.metric ⇒ Object
10
11
12
|
# File 'lib/metric_fu/metrics/rcov/generator.rb', line 10
def self.metric
:rcov
end
|
Instance Method Details
#analyze ⇒ Object
43
44
45
46
47
|
# 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 ⇒ Object
22
23
24
|
# File 'lib/metric_fu/metrics/rcov/generator.rb', line 22
def command
@command ||= default_command
end
|
#command=(command) ⇒ Object
26
27
28
|
# File 'lib/metric_fu/metrics/rcov/generator.rb', line 26
def command=(command)
@command = command
end
|
#default_command ⇒ Object
35
36
37
38
39
40
41
|
# 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 ⇒ Object
14
15
16
17
18
19
20
|
# 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 ⇒ Object
#to_h ⇒ Object
49
50
51
52
53
|
# File 'lib/metric_fu/metrics/rcov/generator.rb', line 49
def to_h
{
rcov: @rcov
}
end
|