4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/ruby_ci/simple_cov/reporting.rb', line 4
def self.included base
base.instance_eval do
unless (ENV['RUBY_CI_SECRET_KEY'] || '').empty?
def write_last_run(result)
::SimpleCov::LastRun.write(result:
result.coverage_statistics.transform_values do |stats|
round_coverage(stats.percent)
end)
source = {}
result.source_files.each do |source_file|
source[source_file.filename.gsub(root, '')] = source_file.src
end
result_json = {}
result.as_json.each do |command, data|
result_json[command] = data
data['coverage'].clone.each do |src, file_data|
result_json[command]['coverage'].delete(src)
file_data['src'] = source[src.gsub(root, '')]
result_json[command]['coverage'][src.gsub(root, '')] = file_data
end
end
RubyCI.report_simplecov(result_json.to_json)
end
end
end
end
|