slather 2.4.6 → 2.4.7

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
  SHA256:
3
- metadata.gz: 87dc3cb198a7c6f4a3e02ab8f0494e8c65d47cc7dfcf5a6a8c683d3f2d7b6630
4
- data.tar.gz: 16ead0627576c7b079f9f29ed54521a8726db794f396d5ee109ea8046c11d212
3
+ metadata.gz: b96a2924692977293e43094ff06f13424436d3e52c4703d7827753164043d65b
4
+ data.tar.gz: 813bb754172204b270f51b2e8548506163a7d38eddd8c8f69899bf0b5b6c789e
5
5
  SHA512:
6
- metadata.gz: b306cecaf97dece04f3c2ad147cc75dae2c2b17f5264bde4582c3815e3d310728d57ed97ecea7c0e3ab25c4d89798e328c3daf169d225e18c370aca04bed524a
7
- data.tar.gz: '03703182714e4ae4bdfbf46e5c2e7fc5c1d1b24416cff13e88be6ff569d3fc3c009e28027f5d6f6163dce0f0079ce87a389adcebe1939b057b431015d1b354c7'
6
+ metadata.gz: 11206bb710d0fbcdc70970113c18c250e94c009ee99b85d8b8fbc655dcd10f1d88d42c7fa29a67cad3e9b07a09ebb4b1866af70f21b54944aeeb898ddc52ffca
7
+ data.tar.gz: 7f0b18beaacafa3e38eaded6df28747619570f6d0a67a4546465485bfcddfcb152543185782703cd32814cd38b86dfb3f68c49876a13a9642eb02f7ae96cb224
@@ -4,7 +4,7 @@ osx_image: xcode9.2
4
4
 
5
5
  before_install:
6
6
  - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
7
- - gem install bundler --no-ri --no-rdoc
7
+ - gem install bundler -v "~> 1.0" --no-ri --no-rdoc
8
8
 
9
9
  install:
10
10
  - bundle install --without=documentation
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.4.7
4
+
5
+ * Update dependencies
6
+ [dnedrow](https://github.com/dnedrow)
7
+
8
+ * Fixed errors when llvm-cov argument length exceeds ARG_MAX
9
+ [weibel](https://github.com/weibel)
10
+ [#414](https://github.com/SlatherOrg/slather/pull/414)
11
+
12
+ * Show "No coverage directory found." instead of "implicit conversion nil into String"
13
+ [phimage](https://github.com/phimage)
14
+ [#381](https://github.com/SlatherOrg/slather/pull/381) [#341](https://github.com/SlatherOrg/slather/issues/341)
15
+
3
16
  ## v2.4.6
4
17
 
5
18
  * Fix .dSYM and .swiftmodule files filtering in find_binary_files()
@@ -118,32 +118,66 @@ module Slather
118
118
 
119
119
  def profdata_coverage_files
120
120
  coverage_files = []
121
- line_numbers_first = Gem::Version.new(self.llvm_version) >= Gem::Version.new('8.1.0')
122
121
 
123
122
  if self.binary_file
124
123
  self.binary_file.each do |binary_path|
125
- coverage_json_string = llvm_cov_export_output(binary_path)
126
- coverage_json = JSON.parse(coverage_json_string)
127
- pathnames_per_binary = coverage_json["data"].reduce([]) do |result, chunk|
128
- result.concat(chunk["files"].map do |file|
129
- Pathname(file["filename"]).realpath
130
- end)
131
- end
124
+ pathnames_per_binary = pathnames_per_binary(binary_path)
125
+ coverage_files.concat(create_coverage_files_for_binary(binary_path, pathnames_per_binary))
126
+ end
127
+ end
132
128
 
133
- files = profdata_llvm_cov_output(binary_path, pathnames_per_binary).split("\n\n")
129
+ coverage_files
130
+ end
131
+ private :profdata_coverage_files
134
132
 
135
- coverage_files.concat(files.map do |source|
136
- coverage_file = coverage_file_class.new(self, source, line_numbers_first)
137
- # If a single source file is used, the resulting output does not contain the file name.
138
- coverage_file.source_file_pathname = pathnames_per_binary.first if pathnames_per_binary.count == 1
139
- !coverage_file.ignored? ? coverage_file : nil
140
- end.compact)
133
+ def pathnames_per_binary(binary_path)
134
+ coverage_json_string = llvm_cov_export_output(binary_path)
135
+ coverage_json = JSON.parse(coverage_json_string)
136
+ coverage_json["data"].reduce([]) do |result, chunk|
137
+ result.concat(chunk["files"].map do |file|
138
+ Pathname(file["filename"]).realpath
139
+ end)
140
+ end
141
+ end
142
+ private :pathnames_per_binary
143
+
144
+ def create_coverage_files_for_binary(binary_path, pathnames_per_binary)
145
+ coverage_files = []
146
+
147
+ begin
148
+ coverage_files.concat(create_coverage_files(binary_path, pathnames_per_binary))
149
+ rescue Errno::E2BIG => e
150
+ # pathnames_per_binary is too big for the OS to handle so it's split in two halfs which are processed independently
151
+ if pathnames_per_binary.count > 1
152
+ left, right = pathnames_per_binary.each_slice( (pathnames_per_binary.size/2.0).round ).to_a
153
+ coverage_files.concat(create_coverage_files_for_binary(binary_path, left))
154
+ coverage_files.concat(create_coverage_files_for_binary(binary_path, right))
155
+ else
156
+ # pathnames_per_binary contains one element which is too big for the OS to handle.
157
+ raise e, "#{e}. A path in your project is close to the E2BIG limit. https://github.com/SlatherOrg/slather/pull/414", e.backtrace
141
158
  end
142
159
  end
143
160
 
144
161
  coverage_files
145
162
  end
146
- private :profdata_coverage_files
163
+ private :create_coverage_files_for_binary
164
+
165
+ def create_coverage_files(binary_path, pathnames)
166
+ line_numbers_first = Gem::Version.new(self.llvm_version) >= Gem::Version.new('8.1.0')
167
+ files = create_profdata(binary_path, pathnames)
168
+ files.map do |source|
169
+ coverage_file = coverage_file_class.new(self, source, line_numbers_first)
170
+ # If a single source file is used, the resulting output does not contain the file name.
171
+ coverage_file.source_file_pathname = pathnames.first if pathnames.count == 1
172
+ !coverage_file.ignored? ? coverage_file : nil
173
+ end.compact
174
+ end
175
+ private :create_coverage_files
176
+
177
+ def create_profdata(binary_path, pathnames)
178
+ profdata_llvm_cov_output(binary_path, pathnames).split("\n\n")
179
+ end
180
+ private :create_profdata
147
181
 
148
182
  def remove_extension(path)
149
183
  path.split(".")[0..-2].join(".")
@@ -180,7 +214,7 @@ module Slather
180
214
  coverage_files = Dir[File.join(build_directory, "../**/ProfileData/*/Coverage.profdata")]
181
215
  end
182
216
 
183
- if coverage_files != nil
217
+ if coverage_files != nil && coverage_files.count != 0
184
218
  dir = Pathname.new(coverage_files.first).parent()
185
219
  end
186
220
  end
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = '2.4.6' unless defined?(Slather::VERSION)
2
+ VERSION = '2.4.7' unless defined?(Slather::VERSION)
3
3
  end
@@ -17,20 +17,20 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_development_dependency 'bundler', '~> 1.6'
21
- spec.add_development_dependency 'coveralls'
22
- spec.add_development_dependency 'simplecov'
23
- spec.add_development_dependency 'rake', '~> 10.4'
24
- spec.add_development_dependency 'rspec', '~> 3.4'
25
- spec.add_development_dependency 'pry', '~> 0.9'
26
- spec.add_development_dependency 'cocoapods', '~> 1.2'
27
- spec.add_development_dependency 'json_spec', '~> 1.1.4'
28
- spec.add_development_dependency 'equivalent-xml', '~> 0.5.1'
20
+ spec.add_development_dependency 'bundler', '~> 1.17'
21
+ spec.add_development_dependency 'coveralls', '~> 0'
22
+ spec.add_development_dependency 'simplecov', '~> 0'
23
+ spec.add_development_dependency 'rake', '~> 12.3'
24
+ spec.add_development_dependency 'rspec', '~> 3.8'
25
+ spec.add_development_dependency 'pry', '~> 0.12'
26
+ spec.add_development_dependency 'cocoapods', '~> 1.5'
27
+ spec.add_development_dependency 'json_spec', '~> 1.1'
28
+ spec.add_development_dependency 'equivalent-xml', '~> 0.6'
29
29
 
30
- spec.add_dependency 'clamp', '~> 0.6'
31
- spec.add_dependency 'xcodeproj', '~> 1.4'
32
- spec.add_dependency 'nokogiri', '~> 1.8.2'
33
- spec.add_dependency 'CFPropertyList', '~> 2.2'
30
+ spec.add_dependency 'clamp', '~> 1.3'
31
+ spec.add_dependency 'xcodeproj', '~> 1.7'
32
+ spec.add_dependency 'nokogiri', '~> 1.8'
33
+ spec.add_dependency 'CFPropertyList', '>= 2.2', '< 4'
34
34
 
35
- spec.add_runtime_dependency 'activesupport', '>= 4.0.2'
35
+ spec.add_runtime_dependency 'activesupport', '< 5', '>= 4.0.2'
36
36
  end
@@ -64,15 +64,78 @@ describe Slather::Project do
64
64
  end
65
65
  end
66
66
 
67
- describe "#profdata_coverage_files" do
67
+ describe "#profdata_coverage_files with large file lists" do
68
68
  class SpecXcode7CoverageFile < Slather::ProfdataCoverageFile
69
69
  end
70
70
 
71
+ llvm_cov_export_output = %q(
72
+ {
73
+ "data":[
74
+ {
75
+ "files":[
76
+ {
77
+ "filename":"spec/fixtures/fixtures/Fixtures.swift"
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "files":[
83
+ {
84
+ "filename":"spec/fixtures/fixtures/Fixtures.swift"
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ })
90
+
91
+ profdata_llvm_cov_output = "#{FIXTURES_SWIFT_FILE_PATH}:
92
+ | 0|
93
+ | 1|import UIKit
94
+ | 2|
95
+ | 3|@UIApplicationMain
96
+ | 4|class AppDelegate: UIResponder, UIApplicationDelegate {
97
+ | 5|
98
+ | 6| var window: UIWindow?
99
+ | 7|
100
+ 1| 8| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
101
+ 1| 9| return true
102
+ 1| 10| }
103
+ | 11|
104
+ 0| 12| func applicationWillResignActive(application: UIApplication) {
105
+ 0| 13| }
106
+ 0| 14|}"
107
+
71
108
  before(:each) do
72
109
  allow(Dir).to receive(:[]).and_call_original
73
110
  allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"])
74
111
  allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"])
75
- allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(%q(
112
+ allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(llvm_cov_export_output)
113
+ allow(fixtures_project).to receive(:coverage_file_class).and_return(SpecXcode7CoverageFile)
114
+ allow(fixtures_project).to receive(:ignore_list).and_return([])
115
+ end
116
+
117
+ it "Should catch Errno::E2BIG and re-raise if the input is too large to split into multiple chunks" do
118
+ allow(fixtures_project).to receive(:unsafe_profdata_llvm_cov_output).and_raise(Errno::E2BIG)
119
+ expect { fixtures_project.send(:profdata_coverage_files) }.to raise_error(Errno::E2BIG, "Argument list too long. A path in your project is close to the E2BIG limit. https://github.com/SlatherOrg/slather/pull/414")
120
+ end
121
+
122
+ it "Should catch Errno::E2BIG and return Coverage.profdata file objects when the work can be split into two" do
123
+ allow(fixtures_project).to receive(:unsafe_profdata_llvm_cov_output).once {
124
+ # raise once and then insert the stub
125
+ allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return(profdata_llvm_cov_output)
126
+ raise Errno::E2BIG
127
+ }
128
+ profdata_coverage_files = fixtures_project.send(:profdata_coverage_files)
129
+ profdata_coverage_files.each { |cf| expect(cf.kind_of?(SpecXcode7CoverageFile)).to be_truthy }
130
+ expect(profdata_coverage_files.map { |cf| cf.source_file_pathname.basename.to_s }).to eq(["Fixtures.swift", "Fixtures.swift"])
131
+ end
132
+ end
133
+
134
+ describe "#profdata_coverage_files" do
135
+ class SpecXcode7CoverageFile < Slather::ProfdataCoverageFile
136
+ end
137
+
138
+ llvm_cov_export_output = %q(
76
139
  {
77
140
  "data":[
78
141
  {
@@ -83,9 +146,9 @@ describe Slather::Project do
83
146
  ]
84
147
  }
85
148
  ]
86
- }
87
- ))
88
- allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("#{FIXTURES_SWIFT_FILE_PATH}:
149
+ })
150
+
151
+ profdata_llvm_cov_output = "#{FIXTURES_SWIFT_FILE_PATH}:
89
152
  | 0|
90
153
  | 1|import UIKit
91
154
  | 2|
@@ -100,7 +163,14 @@ describe Slather::Project do
100
163
  | 11|
101
164
  0| 12| func applicationWillResignActive(application: UIApplication) {
102
165
  0| 13| }
103
- 0| 14|}")
166
+ 0| 14|}"
167
+
168
+ before(:each) do
169
+ allow(Dir).to receive(:[]).and_call_original
170
+ allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"])
171
+ allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"])
172
+ allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(llvm_cov_export_output)
173
+ allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return(profdata_llvm_cov_output)
104
174
  allow(fixtures_project).to receive(:coverage_file_class).and_return(SpecXcode7CoverageFile)
105
175
  allow(fixtures_project).to receive(:ignore_list).and_return([])
106
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slather
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.6
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2019-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.17'
20
20
  type: :development
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: '1.6'
26
+ version: '1.17'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -58,144 +58,153 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.4'
61
+ version: '12.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.4'
68
+ version: '12.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.4'
75
+ version: '3.8'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.4'
82
+ version: '3.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.9'
89
+ version: '0.12'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.9'
96
+ version: '0.12'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: cocoapods
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.2'
103
+ version: '1.5'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.2'
110
+ version: '1.5'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: json_spec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.4
117
+ version: '1.1'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.1.4
124
+ version: '1.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: equivalent-xml
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.5.1
131
+ version: '0.6'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.5.1
138
+ version: '0.6'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: clamp
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.6'
145
+ version: '1.3'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.6'
152
+ version: '1.3'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: xcodeproj
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.4'
159
+ version: '1.7'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.4'
166
+ version: '1.7'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: nokogiri
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.8.2
173
+ version: '1.8'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.8.2
180
+ version: '1.8'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: CFPropertyList
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "~>"
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '2.2'
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '4'
188
191
  type: :runtime
189
192
  prerelease: false
190
193
  version_requirements: !ruby/object:Gem::Requirement
191
194
  requirements:
192
- - - "~>"
195
+ - - ">="
193
196
  - !ruby/object:Gem::Version
194
197
  version: '2.2'
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '4'
195
201
  - !ruby/object:Gem::Dependency
196
202
  name: activesupport
197
203
  requirement: !ruby/object:Gem::Requirement
198
204
  requirements:
205
+ - - "<"
206
+ - !ruby/object:Gem::Version
207
+ version: '5'
199
208
  - - ">="
200
209
  - !ruby/object:Gem::Version
201
210
  version: 4.0.2
@@ -203,6 +212,9 @@ dependencies:
203
212
  prerelease: false
204
213
  version_requirements: !ruby/object:Gem::Requirement
205
214
  requirements:
215
+ - - "<"
216
+ - !ruby/object:Gem::Version
217
+ version: '5'
206
218
  - - ">="
207
219
  - !ruby/object:Gem::Version
208
220
  version: 4.0.2
@@ -326,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
338
  version: '0'
327
339
  requirements: []
328
340
  rubyforge_project:
329
- rubygems_version: 2.7.3
341
+ rubygems_version: 2.7.6
330
342
  signing_key:
331
343
  specification_version: 4
332
344
  summary: Test coverage reports for Xcode projects