simplecov-parallel 0.2.0 → 0.3.0

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: b95a2bd0ff91d28efabb1a19de542ae7b10ee103
4
- data.tar.gz: 1ea1b23f9868c17cb16dfb35fedc696957c89f35
3
+ metadata.gz: 8b1b18a919b8a7444c5deaa06423301665a42b75
4
+ data.tar.gz: 31c6e5df9833b1cdcec3fb45ffa80291c4691d75
5
5
  SHA512:
6
- metadata.gz: db6acf55829fc46ace59cf4bc749009bca9d231684ff36b5d9665d19342d2d78ed101ed60ba2dd867cf8ea62f35297a680ada5fc2035a67c9d75a649f2c8c911
7
- data.tar.gz: ac79ba6164a3741bbdd32b9c66eef4ad87fc1350715787c4e1892d90fd55ee17594c61b30ab65dc800e65aea97aaf03cb594d23474649b2f74a49ce2bacc8473
6
+ metadata.gz: cdca8ec716208c9c2600af61d97e6d27321a43826443eb3d3b1fa6370e1fc9df17ec6124d85521b0009fa4ae9fd701cc2acea98db7db62d1597b3a0c8dd9faae
7
+ data.tar.gz: b3097f911b8977a062dfc460b66856110cee0b6a92a8fa4ede09b70e0303963b18def6bc868c13d38d9ddebf848e220b9f2c698c2b21210ac4e0ec0a6efee440
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Development
4
4
 
5
+ ## v0.3.0
6
+
7
+ * Require `circleci-parallel` 0.5.0 or later.
8
+
5
9
  ## v0.2.0
6
10
 
7
11
  * Require `simplecov` 0.13 or later.
data/README.md CHANGED
@@ -59,7 +59,7 @@ test:
59
59
  - spec/**/*_spec.rb
60
60
  ```
61
61
 
62
- The formatter will be executed only on the first node (`CIRCLE_NODE_INDEX` is `0`).
62
+ The SimpleCov formatter will be executed only on the first node (where `CIRCLE_NODE_INDEX` is `0`).
63
63
 
64
64
  ## License
65
65
 
data/Rakefile CHANGED
@@ -8,6 +8,6 @@ end
8
8
 
9
9
  RuboCop::RakeTask.new
10
10
 
11
- task default: [:spec, :rubocop]
11
+ task default: %i[spec rubocop]
12
12
 
13
- task ci: [:spec, :rubocop]
13
+ task ci: %i[spec rubocop]
@@ -12,22 +12,35 @@ module SimpleCov
12
12
  def activate
13
13
  require 'circleci/parallel'
14
14
  require 'fileutils'
15
+ configure_circleci_parallel
16
+ configure_simplecov
17
+ end
18
+
19
+ private
15
20
 
21
+ def configure_circleci_parallel
22
+ ::CircleCI::Parallel.configure do |config|
23
+ config.on_each_slave_node.before_sync do
24
+ export_slave_node_result
25
+ end
26
+
27
+ config.on_master_node.after_download do
28
+ merge_slave_node_results
29
+ merge_master_node_result_and_format
30
+ end
31
+ end
32
+ end
33
+
34
+ def configure_simplecov
16
35
  SimpleCov.command_name("#{SimpleCov.command_name} #{current_node.name}")
17
36
 
18
37
  SimpleCov.at_exit do
19
38
  puts 'Merging SimpleCov result into the master node...'
20
- export_slave_node_result
21
- join_nodes_and_merge_slave_node_results
22
- merge_and_format_master_node_result
39
+ ::CircleCI::Parallel.sync
23
40
  end
24
41
  end
25
42
 
26
- private
27
-
28
43
  def export_slave_node_result
29
- return if current_node.master?
30
-
31
44
  # Export result to coverage/.resultset.json
32
45
  # https://github.com/colszowka/simplecov/blob/v0.12.0/lib/simplecov.rb#L89
33
46
  raise 'SimpleCov.use_merging must be set to true' unless SimpleCov.use_merging
@@ -39,30 +52,20 @@ module SimpleCov
39
52
  )
40
53
  end
41
54
 
42
- def join_nodes_and_merge_slave_node_results
43
- ::CircleCI::Parallel.configuration.after_download do
44
- merge_slave_node_results
55
+ def merge_slave_node_results
56
+ Dir.glob('node*') do |node_dir|
57
+ results = load_results_from_dir(node_dir)
58
+ merge_and_save_results(results)
45
59
  end
46
-
47
- ::CircleCI::Parallel.join
48
60
  end
49
61
 
50
- def merge_and_format_master_node_result
51
- return unless current_node.master?
52
-
62
+ def merge_master_node_result_and_format
53
63
  # Invoking `SimpleCov.result` here merges the master node data into the slave node data.
54
64
  # `SimpleCov.result.format!` is the default behavior of at_exit:
55
65
  # https://github.com/colszowka/simplecov/blob/v0.12.0/lib/simplecov/configuration.rb#L172
56
66
  SimpleCov.result.format!
57
67
  end
58
68
 
59
- def merge_slave_node_results
60
- Dir.glob('node*') do |node_dir|
61
- results = load_results_from_dir(node_dir)
62
- merge_and_save_results(results)
63
- end
64
- end
65
-
66
69
  def load_results_from_dir(dir)
67
70
  with_changing_resultset_path(dir) do
68
71
  SimpleCov::ResultMerger.results
@@ -2,7 +2,7 @@ module SimpleCov
2
2
  module Parallel
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 2
5
+ MINOR = 3
6
6
  PATCH = 0
7
7
 
8
8
  def self.to_s
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'simplecov/parallel/version'
@@ -19,7 +20,7 @@ Gem::Specification.new do |spec|
19
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_runtime_dependency 'circleci-parallel', '~> 0.4'
23
+ spec.add_runtime_dependency 'circleci-parallel', '~> 0.5'
23
24
  # simplecov 0.12.0 has a bug in result merger.
24
25
  # https://github.com/colszowka/simplecov/pull/513
25
26
  spec.add_runtime_dependency 'simplecov', '~> 0.13'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-17 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: circleci-parallel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.6.8
118
+ rubygems_version: 2.6.11
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: SimpleCov extension for parallelism support