slather 1.5.5 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +9 -3
- data/bin/slather +3 -0
- data/lib/cocoapods_plugin.rb +1 -1
- data/lib/slather/coverage_service/coveralls.rb +40 -0
- data/lib/slather/version.rb +1 -1
- data/slather.gemspec +2 -2
- data/spec/slather/cocoapods_plugin_spec.rb +1 -1
- data/spec/slather/coverage_service/coveralls_spec.rb +18 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caeff7a74b6123adedb9180290935d8167a1a86e
|
4
|
+
data.tar.gz: aeccfc1fea76689b142d40649cd5afc28acdef86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56d7b2b8bd006e5177094a531944c977d0479c53c63f295b7317526901675483d1d45b776e5f06d9f63f11be79160f7808f6c18d6951a04ed473270fedfa096a
|
7
|
+
data.tar.gz: ecd84dbaa23314124826e78d24446e78d38649cf1bef11101b213f2787ab4a5bc3c546f9cfa412ed3144870fdf9f4dd1ba5d1e30f985d7bd9315b4f80c50a012
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -112,9 +112,15 @@ $ slather coverage -x --output-directory path/to/xml_report
|
|
112
112
|
|
113
113
|
### Coverage for code included via CocoaPods
|
114
114
|
|
115
|
-
If you
|
116
|
-
CocoaPods, you will need to tell
|
117
|
-
your
|
115
|
+
If you're trying to compute the coverage of code that has been included via
|
116
|
+
CocoaPods, you will need to tell CocoaPods to use the slather plugin by
|
117
|
+
adding the following to your `Podfile`.
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
plugin 'slather'
|
121
|
+
```
|
122
|
+
|
123
|
+
You will also need to tell slather where to find the source files for your Pod.
|
118
124
|
|
119
125
|
```yml
|
120
126
|
# .slather.yml
|
data/bin/slather
CHANGED
@@ -12,6 +12,7 @@ Clamp do
|
|
12
12
|
parameter "[xcodeproj]", "Path to the xcodeproj", :attribute_name => :xcodeproj_path
|
13
13
|
|
14
14
|
option ["--travis", "-t"], :flag, "Indicate that the builds are running on Travis CI"
|
15
|
+
option ["--circleci"], :flag, "Indicate that the builds are running on CircleCI"
|
15
16
|
|
16
17
|
option ["--coveralls", "-c"], :flag, "Post coverage results to coveralls"
|
17
18
|
option ["--simple-output", "-s"], :flag, "Output coverage results to the terminal"
|
@@ -57,6 +58,8 @@ Clamp do
|
|
57
58
|
def setup_service_name
|
58
59
|
if travis?
|
59
60
|
project.ci_service = :travis_ci
|
61
|
+
elsif circleci?
|
62
|
+
project.ci_service = :circleci
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'slather'
|
2
2
|
|
3
|
-
Pod::HooksManager.register(:post_install) do |installer_context|
|
3
|
+
Pod::HooksManager.register('slather', :post_install) do |installer_context|
|
4
4
|
sandbox_root = installer_context.sandbox_root
|
5
5
|
sandbox = Pod::Sandbox.new(sandbox_root)
|
6
6
|
project = Xcodeproj::Project.open(sandbox.project_path)
|
@@ -11,6 +11,28 @@ module Slather
|
|
11
11
|
ENV['TRAVIS_JOB_ID']
|
12
12
|
end
|
13
13
|
private :travis_job_id
|
14
|
+
|
15
|
+
def circleci_job_id
|
16
|
+
ENV['CIRCLE_BUILD_NUM']
|
17
|
+
end
|
18
|
+
private :circleci_job_id
|
19
|
+
|
20
|
+
def circleci_pull_request
|
21
|
+
ENV['CI_PULL_REQUEST']
|
22
|
+
end
|
23
|
+
private :circleci_pull_request
|
24
|
+
|
25
|
+
def circleci_git_info
|
26
|
+
{
|
27
|
+
:head => {
|
28
|
+
:id => (ENV['CIRCLE_SHA1'] || ""),
|
29
|
+
:author_name => (ENV['CIRCLE_USERNAME'] || ""),
|
30
|
+
:message => (`git log --format=%B -n 1 HEAD`.chomp || "")
|
31
|
+
},
|
32
|
+
:branch => (ENV['CIRCLE_BRANCH'] || "")
|
33
|
+
}
|
34
|
+
end
|
35
|
+
private :circleci_git_info
|
14
36
|
|
15
37
|
def coveralls_coverage_data
|
16
38
|
if ci_service == :travis_ci || ci_service == :travis_pro
|
@@ -32,6 +54,24 @@ module Slather
|
|
32
54
|
else
|
33
55
|
raise StandardError, "Environment variable `TRAVIS_JOB_ID` not set. Is this running on a travis build?"
|
34
56
|
end
|
57
|
+
elsif ci_service == :circleci
|
58
|
+
if circleci_job_id
|
59
|
+
coveralls_hash = {
|
60
|
+
:service_job_id => circleci_job_id,
|
61
|
+
:service_name => "circleci",
|
62
|
+
:repo_token => ci_access_token,
|
63
|
+
:source_files => coverage_files.map(&:as_json),
|
64
|
+
:git => circleci_git_info
|
65
|
+
}
|
66
|
+
|
67
|
+
if circleci_pull_request != nil && circleci_pull_request.length > 0
|
68
|
+
coveralls_hash[:service_pull_request] = circleci_pull_request.split("/").last
|
69
|
+
end
|
70
|
+
|
71
|
+
coveralls_hash.to_json
|
72
|
+
else
|
73
|
+
raise StandardError, "Environment variable `CIRCLE_BUILD_NUM` not set. Is this running on a circleci build?"
|
74
|
+
end
|
35
75
|
else
|
36
76
|
raise StandardError, "No support for ci named #{ci_service}"
|
37
77
|
end
|
data/lib/slather/version.rb
CHANGED
data/slather.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "rake", "~> 10.3"
|
23
23
|
spec.add_development_dependency "rspec", "~> 2.14"
|
24
24
|
spec.add_development_dependency "pry", "~> 0.9"
|
25
|
-
spec.add_development_dependency "cocoapods", "~> 0.
|
25
|
+
spec.add_development_dependency "cocoapods", "~> 0.36.0"
|
26
26
|
spec.add_development_dependency "json_spec", "~> 1.1.4"
|
27
27
|
|
28
28
|
spec.add_dependency "clamp", "~> 0.6"
|
29
|
-
spec.add_dependency "xcodeproj", "~> 0.
|
29
|
+
spec.add_dependency "xcodeproj", "~> 0.23.0"
|
30
30
|
spec.add_dependency "nokogiri", "~> 1.6.3"
|
31
31
|
end
|
@@ -14,7 +14,7 @@ describe Slather do
|
|
14
14
|
sandbox_root = 'Pods'
|
15
15
|
sandbox = Pod::Sandbox.new(sandbox_root)
|
16
16
|
context = Pod::Installer::HooksContext.generate(sandbox, [])
|
17
|
-
Pod::HooksManager.run(:post_install, context)
|
17
|
+
Pod::HooksManager.run(:post_install, context, {'slather' => nil})
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -54,6 +54,24 @@ describe Slather::CoverageService::Coveralls do
|
|
54
54
|
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
context "coverage_service is :circleci" do
|
59
|
+
before(:each) { fixtures_project.ci_service = :circleci }
|
60
|
+
|
61
|
+
it "should return valid json for coveralls coverage data" do
|
62
|
+
fixtures_project.stub(:circleci_job_id).and_return("9182")
|
63
|
+
fixtures_project.stub(:ci_access_token).and_return("abc123")
|
64
|
+
fixtures_project.stub(:circleci_pull_request).and_return("1")
|
65
|
+
fixtures_project.stub(:circleci_git_info).and_return({ :head => { :id => "ababa123", :author_name => "bwayne", :message => "hello" }, :branch => "master" })
|
66
|
+
expect(fixtures_project.send(:coveralls_coverage_data)).to be_json_eql("{\"service_job_id\":\"9182\",\"service_name\":\"circleci\",\"repo_token\":\"abc123\",\"service_pull_request\":\"1\",\"git\":{\"head\":{\"id\":\"ababa123\",\"author_name\":\"bwayne\",\"message\":\"hello\"},\"branch\":\"master\"}}").excluding("source_files")
|
67
|
+
expect(fixtures_project.send(:coveralls_coverage_data)).to be_json_eql(fixtures_project.send(:coverage_files).map(&:as_json).to_json).at_path("source_files")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should raise an error if there is no CIRCLE_BUILD_NUM" do
|
71
|
+
fixtures_project.stub(:circleci_job_id).and_return(nil)
|
72
|
+
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
73
|
+
end
|
74
|
+
end
|
57
75
|
|
58
76
|
it "should raise an error if it does not recognize the ci_service" do
|
59
77
|
fixtures_project.ci_service = :jenkins_ci
|
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: 1.
|
4
|
+
version: 1.6.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: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.36.0
|
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:
|
96
|
+
version: 0.36.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: json_spec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.23.0
|
132
132
|
type: :runtime
|
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.
|
138
|
+
version: 0.23.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: nokogiri
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|