slather 2.2.1 → 2.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: 8096ea189a9cebaad5a72f45dce58fd1f9f6b284
4
- data.tar.gz: 15d24647aeba911b4e194dd150ea9700335fe21c
3
+ metadata.gz: 5e27d1218948f82525f0b2ed8a6a98204b717fc1
4
+ data.tar.gz: bbaffb2b00075ab13a568ae40992d1cb09138e0f
5
5
  SHA512:
6
- metadata.gz: 311d63ca7b84e89bbdda3f1f0a0d7063df7c2e890ca96bb9a81d3aead8263ee14a18b0264d506107600d0985cf4fa3519527d2808ea3a169b21b5d9ba4c739fc
7
- data.tar.gz: e138521b5d249354893eb05c24a88edf245cf649d1c0338aa3e757721bd9e7127132ae5b84d456e1562b58ec7b32b1f574149763c74eb4e7b14d8d10e5cb7365
6
+ metadata.gz: 751fde31c23722c6c143ac0a1bd04421dcb9be6ef3074c97209667ac6e6da393b02dae0457ba36b9223f5d785657be191cba67336d9a960861a0089619bcd43c
7
+ data.tar.gz: 31953c5059db5e6197f6fc61fd2b7b1c6173f6c9a77a7dadd4888cf45cca8c88c7bb460271aa8529655c519bd8b90cba15ab84044d041245ac6a9c28b12d1606
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v2.3.0
6
+
7
+ * Fixes broken fallback value of `input_format` inside `configure_input_format`
8
+ [sbhklr](https://github.com/sbhklr)
9
+ [#233](https://github.com/SlatherOrg/slather/pull/233), [#232](https://github.com/SlatherOrg/slather/issues/232)
10
+
11
+ * Add `--travispro` flag
12
+ [sbhklr](https://github.com/sbhklr)
13
+ [#223](https://github.com/SlatherOrg/slather/pull/223), [#219](https://github.com/SlatherOrg/slather/issues/219)
14
+
15
+ * Fixes silent failure in case of unsuccessful upload to Coveralls
16
+ [sbhklr](https://github.com/sbhklr)
17
+ [#222](https://github.com/SlatherOrg/slather/pull/222), [#217](https://github.com/SlatherOrg/slather/issues/217)
18
+
5
19
  ## v2.2.1
6
20
 
7
21
  * Make `project.coverage_files` public
@@ -3,6 +3,7 @@ class CoverageCommand < Clamp::Command
3
3
  parameter "[PROJECT]", "Path to the xcodeproj", :attribute_name => :xcodeproj_path
4
4
 
5
5
  option ["--travis", "-t"], :flag, "Indicate that the builds are running on Travis CI"
6
+ option ["--travispro"], :flag, "Indicate that the builds are running on Travis Pro CI"
6
7
  option ["--circleci"], :flag, "Indicate that the builds are running on CircleCI"
7
8
  option ["--jenkins"], :flag, "Indicate that the builds are running on Jenkins"
8
9
  option ["--buildkite"], :flag, "Indicate that the builds are running on Buildkite"
@@ -73,6 +74,8 @@ class CoverageCommand < Clamp::Command
73
74
  def setup_service_name
74
75
  if travis?
75
76
  project.ci_service = :travis_ci
77
+ elsif travispro?
78
+ project.ci_service = :travis_pro
76
79
  elsif circleci?
77
80
  project.ci_service = :circleci
78
81
  elsif jenkins?
@@ -100,12 +100,22 @@ module Slather
100
100
  if ci_service == :travis_ci || ci_service == :travis_pro
101
101
  if travis_job_id
102
102
  if ci_service == :travis_ci
103
+
104
+ if coverage_access_token.to_s.strip.length > 0
105
+ raise StandardError, "Access token is set. Uploading coverage data for public repositories doesn't require an access token."
106
+ end
107
+
103
108
  {
104
109
  :service_job_id => travis_job_id,
105
110
  :service_name => "travis-ci",
106
111
  :source_files => coverage_files.map(&:as_json)
107
112
  }.to_json
108
- elsif ci_service == :travis_pro
113
+ elsif ci_service == :travis_pro
114
+
115
+ if coverage_access_token.to_s.strip.length == 0
116
+ raise StandardError, "Access token is not set. Uploading coverage data for private repositories requires an access token."
117
+ end
118
+
109
119
  {
110
120
  :service_job_id => travis_job_id,
111
121
  :service_name => "travis-pro",
@@ -172,7 +182,18 @@ module Slather
172
182
  begin
173
183
  f.write(coveralls_coverage_data)
174
184
  f.close
175
- `curl -s --form json_file=@#{f.path} #{coveralls_api_jobs_path}`
185
+
186
+ curl_result = `curl -s --form json_file=@#{f.path} #{coveralls_api_jobs_path}`
187
+
188
+ if curl_result.is_a? String
189
+ curl_result_json = JSON.parse(curl_result)
190
+
191
+ if curl_result_json["error"]
192
+ error_message = curl_result_json["message"]
193
+ raise StandardError, "Error while uploading coverage data to Coveralls. CI Service: #{ci_service} Message: #{error_message}"
194
+ end
195
+ end
196
+
176
197
  rescue StandardError => e
177
198
  FileUtils.rm(f)
178
199
  raise e
@@ -277,7 +277,7 @@ module Slather
277
277
  end
278
278
 
279
279
  def configure_input_format
280
- self.input_format ||= self.class.yml["input_format"] || input_format
280
+ self.input_format ||= (self.class.yml["input_format"] || "auto")
281
281
  end
282
282
 
283
283
  def input_format=(format)
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = '2.2.1' unless defined?(Slather::VERSION)
2
+ VERSION = '2.3.0' unless defined?(Slather::VERSION)
3
3
  end
@@ -28,6 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "equivalent-xml", "~> 0.5.1"
29
29
 
30
30
  spec.add_dependency "clamp", "~> 0.6"
31
- spec.add_dependency "xcodeproj", "~> 1.1"
31
+ spec.add_dependency "xcodeproj", "< 2.0.0", ">= 0.20"
32
32
  spec.add_dependency "nokogiri", "~> 1.6.3"
33
+
34
+ ## Version 5 needs Ruby 2.2, so we specify an upper bound to stay compatible with system ruby
35
+ spec.add_runtime_dependency 'activesupport', '>= 4.0.2', '< 5'
33
36
  end
@@ -41,6 +41,12 @@ describe Slather::CoverageService::Coveralls do
41
41
  allow(fixtures_project).to receive(:travis_job_id).and_return(nil)
42
42
  expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
43
43
  end
44
+
45
+ it "should raise an error if there is a COVERAGE_ACCESS_TOKEN" do
46
+ allow(fixtures_project).to receive(:coverage_access_token).and_return("abc123")
47
+ expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
48
+ end
49
+
44
50
  end
45
51
 
46
52
  context "coverage_service is :travis_pro" do
@@ -57,6 +63,12 @@ describe Slather::CoverageService::Coveralls do
57
63
  allow(fixtures_project).to receive(:travis_job_id).and_return(nil)
58
64
  expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
59
65
  end
66
+
67
+ it "should raise an error if there is no COVERAGE_ACCESS_TOKEN" do
68
+ allow(fixtures_project).to receive(:coverage_access_token).and_return("")
69
+ expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
70
+ end
71
+
60
72
  end
61
73
 
62
74
  context "coverage_service is :circleci" do
@@ -143,6 +155,13 @@ describe Slather::CoverageService::Coveralls do
143
155
  fixtures_project.post
144
156
  end
145
157
 
158
+ it "should save the coveralls_coverage_data to a file, post it to coveralls, and fail due to a Coveralls error" do
159
+ allow(fixtures_project).to receive(:travis_job_id).and_return("9182")
160
+ allow(fixtures_project).to receive(:`).and_return("{\"message\":\"Couldn't find a repository matching this job.\",\"error\":true}")
161
+ expect(fixtures_project).to receive(:`).once
162
+ expect { fixtures_project.post }.to raise_error(StandardError)
163
+ end
164
+
146
165
  it "should always remove the coveralls_json_file after it's done" do
147
166
  allow(fixtures_project).to receive(:`)
148
167
  allow(fixtures_project).to receive(:travis_job_id).and_return("9182")
@@ -394,6 +394,28 @@ describe Slather::Project do
394
394
 
395
395
  end
396
396
 
397
+ describe "#configure_input_format" do
398
+ it "should set the input_format if it has been provided by the yml" do
399
+ allow(Slather::Project).to receive(:yml).and_return({"input_format" => "gcov"})
400
+ fixtures_project.configure_input_format
401
+ expect(fixtures_project.input_format).to eq("gcov")
402
+ end
403
+
404
+ it "should default the input_format to auto if nothing is provided in the yml" do
405
+ allow(Slather::Project).to receive(:yml).and_return({})
406
+ expect(fixtures_project).to receive(:input_format=).with("auto")
407
+ fixtures_project.configure_input_format
408
+ end
409
+
410
+ it "should not set the input_format if it has already been set" do
411
+ allow(Slather::Project).to receive(:yml).and_return({"input_format" => "some_format" })
412
+ fixtures_project.input_format = "gcov"
413
+ expect(fixtures_project).to_not receive(:input_format=)
414
+ fixtures_project.configure_input_format
415
+ end
416
+
417
+ end
418
+
397
419
  describe "#coverage_service=" do
398
420
  it "should extend Slather::CoverageService::Coveralls and set coverage_service = :coveralls if given coveralls" do
399
421
  expect(fixtures_project).to receive(:extend).with(Slather::CoverageService::Coveralls)
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.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,16 +154,22 @@ dependencies:
154
154
  name: xcodeproj
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - <
158
+ - !ruby/object:Gem::Version
159
+ version: 2.0.0
160
+ - - '>='
158
161
  - !ruby/object:Gem::Version
159
- version: '1.1'
162
+ version: '0.20'
160
163
  type: :runtime
161
164
  prerelease: false
162
165
  version_requirements: !ruby/object:Gem::Requirement
163
166
  requirements:
164
- - - ~>
167
+ - - <
168
+ - !ruby/object:Gem::Version
169
+ version: 2.0.0
170
+ - - '>='
165
171
  - !ruby/object:Gem::Version
166
- version: '1.1'
172
+ version: '0.20'
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: nokogiri
169
175
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +184,26 @@ dependencies:
178
184
  - - ~>
179
185
  - !ruby/object:Gem::Version
180
186
  version: 1.6.3
187
+ - !ruby/object:Gem::Dependency
188
+ name: activesupport
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - '>='
192
+ - !ruby/object:Gem::Version
193
+ version: 4.0.2
194
+ - - <
195
+ - !ruby/object:Gem::Version
196
+ version: '5'
197
+ type: :runtime
198
+ prerelease: false
199
+ version_requirements: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - '>='
202
+ - !ruby/object:Gem::Version
203
+ version: 4.0.2
204
+ - - <
205
+ - !ruby/object:Gem::Version
206
+ version: '5'
181
207
  description:
182
208
  email:
183
209
  - mark@venmo.com
@@ -289,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
315
  version: '0'
290
316
  requirements: []
291
317
  rubyforge_project:
292
- rubygems_version: 2.0.14
318
+ rubygems_version: 2.0.14.1
293
319
  signing_key:
294
320
  specification_version: 4
295
321
  summary: Test coverage reports for Xcode projects