simplecov-parallel 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/simplecov/parallel/adapter/circleci.rb +27 -7
- data/lib/simplecov/parallel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef73c5648b57532f6b44d43cafd921779a969366
|
4
|
+
data.tar.gz: 6b542836cc4264a7a60ae18c4b61b0a8a6dd1ba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e2bb376613c10b3c27aa4035a993983e3f2239f6406e12106778ec60835f47d2eb6728cdeae1d2cabe1f0314a57334d1ed543877988b8b5cacf4500fc4f33a2
|
7
|
+
data.tar.gz: 6af0c497e862afd8e6c482c62756c1a72d08f233570accb4a9afc9ecb33e4bf6e968cfbfcb20542c32f06b522190644fd76dfa658b9c5d9ece51331dc053c32a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
# SimpleCov::Parallel
|
7
7
|
|
8
8
|
**SimpleCov::Parallel** is a [SimpleCov](https://github.com/colszowka/simplecov) extension for parallelism support.
|
9
|
+
It automatically transfers each node coverage data to a single master node and merges the data.
|
9
10
|
Currently only [CircleCI parallelism](https://circleci.com/docs/parallelism/) is supported.
|
10
11
|
|
11
12
|
## Installation
|
@@ -78,24 +78,44 @@ module SimpleCov
|
|
78
78
|
# SimpleCov.root and SimpleCov.coverage_dir does not work well because .root is used in
|
79
79
|
# the root filter, which is invoked from SimpleCov::Result#initialize.
|
80
80
|
# https://github.com/colszowka/simplecov/blob/v0.12.0/lib/simplecov/defaults.rb#L9
|
81
|
-
|
82
|
-
|
83
|
-
singleton_class = SimpleCov::ResultMerger.singleton_class
|
81
|
+
method_stasher = MethodStasher.new(SimpleCov::ResultMerger, :resultset_path)
|
82
|
+
method_stasher.stash
|
84
83
|
|
85
|
-
|
86
|
-
|
84
|
+
SimpleCov::ResultMerger.define_singleton_method(:resultset_path) do
|
85
|
+
File.join(dir, '.resultset.json')
|
86
|
+
end
|
87
87
|
|
88
88
|
begin
|
89
89
|
yield
|
90
90
|
ensure
|
91
|
-
|
92
|
-
singleton_class.__send__(:define_method, method_name, original_method)
|
91
|
+
method_stasher.pop
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
96
95
|
def current_node
|
97
96
|
::CircleCI::Parallel.current_node
|
98
97
|
end
|
98
|
+
|
99
|
+
MethodStasher = Struct.new(:object, :method_name) do
|
100
|
+
def stash
|
101
|
+
@original_method = object.method(method_name)
|
102
|
+
klass.__send__(:undef_method, method_name)
|
103
|
+
end
|
104
|
+
|
105
|
+
def pop
|
106
|
+
if klass.__send__(:method_defined?, method_name)
|
107
|
+
klass.__send__(:undef_method, method_name)
|
108
|
+
end
|
109
|
+
|
110
|
+
klass.__send__(:define_method, method_name, @original_method)
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def klass
|
116
|
+
object.singleton_class
|
117
|
+
end
|
118
|
+
end
|
99
119
|
end
|
100
120
|
end
|
101
121
|
end
|