codeclimate_circle_ci_coverage 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6df1def6d5a186eae8a145fcfbe10098a889c687
4
- data.tar.gz: 48be67e61f8ad0c882c5f2ef53612d31c34eca89
3
+ metadata.gz: 67bfae6c72737c855a4b3c6be69979a3ee84add6
4
+ data.tar.gz: 92e7931968750958c8d59795d4da3620d2538c28
5
5
  SHA512:
6
- metadata.gz: 444a6e998603995f45199ed62ce2557716ba83627956ec61f6ae08e8ec65cdd8761fe296d1160524e5d580a3ae192cd49e795f52dc9701b3a87a6f886e548d26
7
- data.tar.gz: c53240fdf9ac417afb10dfa682153d58901670ad6e5294995a242e762ef44d800ed8493d979ff3d7e05ef3d0c5fb7abeca4f27d7d09f442dd695eeae2a2cd311
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.run
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
- def self.run
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 master branch
67
- exit if branch != 'master'
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/circle"
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.2
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/circle.rb
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