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
|
# File 'lib/cc_cover_report.rb', line 5
def self.report(repo_key = nil)
begin
repo_key ||= ENV['CC_REPO_KEY']
if repo_key.present?
index_file = SimpleCov.coverage_path + "/index.html"
if SimpleCov.running
silence_stream(STDOUT) do
SimpleCov::Formatter::HTMLFormatter.new.format(SimpleCov.result)
end
end
if File.exist?(index_file)
RestClient::Request.execute(:url => 'https://codecop.encore.io/api/coverage.json', :method => :post, :verify_ssl => false,
:payload => {
:commit => `git log --pretty=%P -n 1`.chomp,
:repo_key => repo_key,
:coverage_file => File.new(index_file)}
)
puts "Pushed coverage report to CC"
end
else
end
rescue Exception
end
end
|