codeclimate_circle_ci_coverage 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67bfae6c72737c855a4b3c6be69979a3ee84add6
|
4
|
+
data.tar.gz: 92e7931968750958c8d59795d4da3620d2538c28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbd85a77c464ffc845b7d8a6d497ff4489fc7cfa2d3afa26c4af362cdac5912f62e675f90a1434f3bb9ed268b120f481c597ec434d5bded13daaec423a2e492
|
7
|
+
data.tar.gz: fb71b420138d3ab440c58440648b99d19af3653eaee7620a56e4e17c3f1e21fb63f9a4088a084aa0a8423ca4f5a4bfadd749143c0a6595fa6ff1f30d0f7449b6
|
data/bin/report_coverage
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
2
|
require 'codeclimate_circle_ci_coverage'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = { branch: 'master' }
|
6
|
+
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: report_coverag [options]"
|
9
|
+
|
10
|
+
opts.on('-b', '--branch [branch name]', 'Branch name',
|
11
|
+
'Specify branch name to report coverage (default "master")') do |v|
|
12
|
+
options[:branch] = v
|
13
|
+
end
|
14
|
+
end.parse!
|
4
15
|
|
5
|
-
CoverageReporter.
|
16
|
+
reporter = CoverageReporter.new(options[:branch])
|
17
|
+
reporter.run
|
@@ -1,6 +1,3 @@
|
|
1
|
-
# This packages up the code coverage metrics and
|
2
|
-
# sends them to CodeClimate via the CodeClimate Test Reporter Gem
|
3
|
-
|
4
1
|
# from https://github.com/codeclimate/ruby-test-reporter/issues/10
|
5
2
|
# https://gist.github.com/evanwhalen/f74879e0549b67eb17bb
|
6
3
|
|
@@ -13,8 +10,16 @@ require "codeclimate-test-reporter"
|
|
13
10
|
require "simplecov"
|
14
11
|
require 'fileutils'
|
15
12
|
|
13
|
+
# This packages up the code coverage metrics from multiple servers and
|
14
|
+
# sends them to CodeClimate via the CodeClimate Test Reporter Gem
|
16
15
|
class CoverageReporter
|
17
|
-
|
16
|
+
attr_reader :target_branch
|
17
|
+
|
18
|
+
def initialize(target_branch)
|
19
|
+
@target_branch = target_branch
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
18
23
|
branch = ENV['CIRCLE_BRANCH']
|
19
24
|
node_index = ENV['CIRCLE_NODE_INDEX'].to_i
|
20
25
|
node_total = ENV['CIRCLE_NODE_TOTAL'].to_i
|
@@ -63,8 +68,8 @@ class CoverageReporter
|
|
63
68
|
html_formatter = SimpleCov::Formatter::HTMLFormatter.new
|
64
69
|
html_formatter.format(merged_result)
|
65
70
|
|
66
|
-
# Only submit coverage to codeclimate on
|
67
|
-
exit if branch !=
|
71
|
+
# Only submit coverage to codeclimate on target branch
|
72
|
+
exit if branch != target_branch
|
68
73
|
|
69
74
|
# Post merged coverage result to codeclimate
|
70
75
|
codeclimate_formatter = CodeClimate::TestReporter::Formatter.new
|
@@ -1 +1 @@
|
|
1
|
-
require "codeclimate_circle_ci_coverage/
|
1
|
+
require "codeclimate_circle_ci_coverage/coverage_reporter"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate_circle_ci_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Dunlop
|
@@ -62,7 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- bin/report_coverage
|
64
64
|
- lib/codeclimate_circle_ci_coverage.rb
|
65
|
-
- lib/codeclimate_circle_ci_coverage/
|
65
|
+
- lib/codeclimate_circle_ci_coverage/coverage_reporter.rb
|
66
66
|
homepage: http://rubygems.org/gems/codeclimate_circle_ci_coverage
|
67
67
|
licenses:
|
68
68
|
- MIT
|