percy-client 1.13.0 → 1.13.1
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 +4 -4
- data/.rubocop.yml +6 -75
- data/Gemfile +0 -5
- data/lib/percy.rb +5 -0
- data/lib/percy/client/environment.rb +11 -8
- data/lib/percy/client/version.rb +1 -1
- data/percy-client.gemspec +1 -0
- data/spec/lib/percy/client/builds_spec.rb +1 -1
- data/spec/lib/percy/client/environment_spec.rb +9 -5
- data/spec/lib/percy/client/resources_spec.rb +27 -21
- data/spec/lib/percy/config_spec.rb +1 -1
- metadata +17 -4
- data/.rubocop_todo.yml +0 -101
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd5e53a2a31b6d624b67f40255d1cb403e43df54
|
4
|
+
data.tar.gz: c7272d9503ead0a38e147bc33b2923f1227d742f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c9153ac7a3b8f30402a54ec48f23f795f539e8cbd13810f006d037d94c0131ac96142b06f406b7ba5b96242c3a74354e60562e6edf49eebb0bcee2760c20b0'
|
7
|
+
data.tar.gz: 0473a03972385f577096e39ce9bbf46f5f46e69ccdec4160f5ac7f47d0702b6cc14fc2183458705c2a136c12d570325c464a667168c9030de7e12c37be78da4c
|
data/.rubocop.yml
CHANGED
@@ -1,76 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Include:
|
5
|
-
- Rakefile
|
6
|
-
- lib/**/*.rake
|
7
|
-
Exclude:
|
8
|
-
- 'vendor/**/*'
|
9
|
-
- 'percy-client.gemspec'
|
10
|
-
|
11
|
-
Lint/EndAlignment:
|
12
|
-
EnforcedStyleAlignWith: variable
|
13
|
-
|
14
|
-
Metrics/LineLength:
|
15
|
-
Max: 101
|
16
|
-
|
17
|
-
Style/AlignParameters:
|
18
|
-
EnforcedStyle: with_fixed_indentation
|
19
|
-
|
20
|
-
Style/CaseIndentation:
|
21
|
-
EnforcedStyle: end
|
22
|
-
|
23
|
-
Style/Documentation:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Style/DoubleNegation:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/IndentArray:
|
30
|
-
EnforcedStyle: consistent
|
31
|
-
|
32
|
-
Style/MultilineMethodCallIndentation:
|
33
|
-
EnforcedStyle: indented
|
34
|
-
|
35
|
-
Style/MultilineOperationIndentation:
|
36
|
-
EnforcedStyle: indented
|
37
|
-
|
38
|
-
# Disable Style/NumericLiterals so numbers don't need underscores
|
39
|
-
Style/NumericLiterals:
|
40
|
-
Enabled: false
|
41
|
-
|
42
|
-
Style/FileName:
|
43
|
-
Enabled: false
|
1
|
+
inherit_gem:
|
2
|
+
percy-style:
|
3
|
+
- default.yml
|
44
4
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Style/NumericPredicate:
|
49
|
-
EnforcedStyle: comparison
|
50
|
-
|
51
|
-
Style/RedundantBegin:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Style/RegexpLiteral:
|
55
|
-
EnforcedStyle: slashes
|
56
|
-
AllowInnerSlashes: true
|
57
|
-
|
58
|
-
Style/SpaceInsideHashLiteralBraces:
|
59
|
-
EnforcedStyle: no_space
|
60
|
-
|
61
|
-
Style/TrailingCommaInArguments:
|
62
|
-
EnforcedStyleForMultiline: consistent_comma
|
63
|
-
|
64
|
-
Style/TrailingCommaInLiteral:
|
65
|
-
EnforcedStyleForMultiline: consistent_comma
|
66
|
-
|
67
|
-
RSpec/MessageSpies:
|
68
|
-
EnforcedStyle: receive
|
69
|
-
|
70
|
-
RSpec/NotToNot:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
|
74
|
-
# Will be able to do this in >= v1.11
|
75
|
-
# RSpec/DescribedClass:
|
76
|
-
# EnforcedStyle: explicit
|
5
|
+
RSpec/InstanceVariable:
|
6
|
+
Exclude:
|
7
|
+
- spec/lib/percy/client/environment_spec.rb
|
data/Gemfile
CHANGED
data/lib/percy.rb
CHANGED
@@ -36,7 +36,7 @@ module Percy
|
|
36
36
|
commit_sha = _commit_sha || output && output.match(/COMMIT_SHA:(.*)/)[1]
|
37
37
|
|
38
38
|
# If not running in a git repo, allow nils for certain commit attributes.
|
39
|
-
|
39
|
+
parse = ->(regex) { (output && output.match(regex) || [])[1] }
|
40
40
|
{
|
41
41
|
# The only required attribute:
|
42
42
|
branch: branch,
|
@@ -44,14 +44,14 @@ module Percy
|
|
44
44
|
sha: commit_sha,
|
45
45
|
|
46
46
|
# Optional attributes:
|
47
|
-
message:
|
48
|
-
committed_at:
|
47
|
+
message: parse.call(/COMMIT_MESSAGE:(.*)/m),
|
48
|
+
committed_at: parse.call(/COMMITTED_DATE:(.*)/),
|
49
49
|
# These GIT_ environment vars are from the Jenkins Git Plugin, but could be
|
50
50
|
# used generically. This behavior may change in the future.
|
51
|
-
author_name:
|
52
|
-
author_email:
|
53
|
-
committer_name:
|
54
|
-
committer_email:
|
51
|
+
author_name: parse.call(/AUTHOR_NAME:(.*)/) || ENV['GIT_AUTHOR_NAME'],
|
52
|
+
author_email: parse.call(/AUTHOR_EMAIL:(.*)/) || ENV['GIT_AUTHOR_EMAIL'],
|
53
|
+
committer_name: parse.call(/COMMITTER_NAME:(.*)/) || ENV['GIT_COMMITTER_NAME'],
|
54
|
+
committer_email: parse.call(/COMMITTER_EMAIL:(.*)/) || ENV['GIT_COMMITTER_EMAIL'],
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
@@ -100,7 +100,7 @@ module Percy
|
|
100
100
|
|
101
101
|
result = case current_ci
|
102
102
|
when :jenkins
|
103
|
-
ENV['
|
103
|
+
ENV['ghprbSourceBranch']
|
104
104
|
when :travis
|
105
105
|
if pull_request_number
|
106
106
|
ENV['TRAVIS_PULL_REQUEST_BRANCH']
|
@@ -185,6 +185,7 @@ module Percy
|
|
185
185
|
end
|
186
186
|
when :codeship
|
187
187
|
# Unfortunately, codeship always returns 'false' for CI_PULL_REQUEST. For now, return nil.
|
188
|
+
nil
|
188
189
|
when :drone
|
189
190
|
ENV['CI_PULL_REQUEST']
|
190
191
|
when :semaphore
|
@@ -204,6 +205,8 @@ module Percy
|
|
204
205
|
ENV['TRAVIS_BUILD_NUMBER']
|
205
206
|
when :circle
|
206
207
|
ENV['CIRCLE_BUILD_NUM']
|
208
|
+
when :jenkins
|
209
|
+
ENV['BUILD_NUMBER']
|
207
210
|
when :codeship
|
208
211
|
ENV['CI_BUILD_NUMBER']
|
209
212
|
when :semaphore
|
data/lib/percy/client/version.rb
CHANGED
data/percy-client.gemspec
CHANGED
@@ -23,9 +23,10 @@ RSpec.describe Percy::Client::Environment do
|
|
23
23
|
|
24
24
|
# Unset Jenkins vars.
|
25
25
|
ENV['JENKINS_URL'] = nil
|
26
|
+
ENV['BUILD_NUMBER'] = nil
|
26
27
|
ENV['ghprbPullId'] = nil
|
27
28
|
ENV['ghprbActualCommit'] = nil
|
28
|
-
ENV['
|
29
|
+
ENV['ghprbSourceBranch'] = nil
|
29
30
|
|
30
31
|
# Unset Circle CI vars.
|
31
32
|
ENV['CIRCLECI'] = nil
|
@@ -244,17 +245,20 @@ RSpec.describe Percy::Client::Environment do
|
|
244
245
|
context 'in Jenkins CI' do
|
245
246
|
before(:each) do
|
246
247
|
ENV['JENKINS_URL'] = 'http://localhost:8080/'
|
247
|
-
ENV['
|
248
|
-
ENV['
|
248
|
+
ENV['BUILD_NUMBER'] = '111'
|
249
|
+
ENV['ghprbPullId'] = '256'
|
250
|
+
ENV['ghprbSourceBranch'] = 'jenkins-source-branch'
|
249
251
|
ENV['ghprbActualCommit'] = 'jenkins-actual-commit'
|
250
252
|
end
|
251
253
|
|
252
254
|
it 'has the correct properties' do
|
253
255
|
expect(Percy::Client::Environment.current_ci).to eq(:jenkins)
|
254
|
-
expect(Percy::Client::Environment.branch).to eq('jenkins-
|
256
|
+
expect(Percy::Client::Environment.branch).to eq('jenkins-source-branch')
|
255
257
|
expect(Percy::Client::Environment._commit_sha).to eq('jenkins-actual-commit')
|
256
|
-
expect(Percy::Client::Environment.pull_request_number).to eq('
|
258
|
+
expect(Percy::Client::Environment.pull_request_number).to eq('256')
|
257
259
|
expect(Percy::Client::Environment.repo).to eq('percy/percy-client')
|
260
|
+
expect(Percy::Client::Environment.parallel_nonce).to eq('111')
|
261
|
+
expect(Percy::Client::Environment.parallel_total_shards).to eq(nil)
|
258
262
|
end
|
259
263
|
end
|
260
264
|
|
@@ -2,7 +2,7 @@ require 'digest'
|
|
2
2
|
|
3
3
|
# rubocop:disable RSpec/MultipleDescribes
|
4
4
|
RSpec.describe Percy::Client::Resources, :vcr do
|
5
|
-
let(:content) { "hello world! #{
|
5
|
+
let(:content) { "hello world! #{Percy::Client::Resources.name}" }
|
6
6
|
let(:sha) { Digest::SHA256.hexdigest(content) }
|
7
7
|
|
8
8
|
describe '#upload_resource' do
|
@@ -19,11 +19,11 @@ RSpec.describe Percy::Client::Resources, :vcr do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
RSpec.describe Percy::Client::Resource do
|
22
|
-
let(:content) { "hello world! #{
|
22
|
+
let(:content) { "hello world! #{Percy::Client::Resource.name}" }
|
23
23
|
let(:sha) { Digest::SHA256.hexdigest(content) }
|
24
24
|
|
25
25
|
it 'can be initialized with minimal data' do
|
26
|
-
resource =
|
26
|
+
resource = Percy::Client::Resource.new('/foo.html', sha: sha)
|
27
27
|
expect(resource.serialize).to eq(
|
28
28
|
'type' => 'resources',
|
29
29
|
'id' => sha,
|
@@ -35,7 +35,7 @@ RSpec.describe Percy::Client::Resource do
|
|
35
35
|
)
|
36
36
|
end
|
37
37
|
it 'can be initialized with all data' do
|
38
|
-
resource =
|
38
|
+
resource = Percy::Client::Resource.new(
|
39
39
|
'/foo new.html',
|
40
40
|
sha: sha,
|
41
41
|
is_root: true,
|
@@ -53,48 +53,54 @@ RSpec.describe Percy::Client::Resource do
|
|
53
53
|
)
|
54
54
|
end
|
55
55
|
it 'errors if not given sha or content' do
|
56
|
-
expect {
|
56
|
+
expect { Percy::Client::Resource.new('/foo.html') }.to raise_error(ArgumentError)
|
57
57
|
end
|
58
58
|
|
59
59
|
describe 'object equality' do
|
60
|
-
subject(:resource)
|
60
|
+
subject(:resource) do
|
61
|
+
Percy::Client::Resource.new('/some-content', sha: sha, mimetype: mimetype)
|
62
|
+
end
|
61
63
|
|
62
64
|
let(:sha) { '123456' }
|
63
65
|
let(:mimetype) { 'text/plain' }
|
64
66
|
|
65
67
|
describe 'two resources with same properties' do
|
66
|
-
let(:other) {
|
68
|
+
let(:other) { Percy::Client::Resource.new('/some-content', sha: sha, mimetype: mimetype) }
|
67
69
|
|
68
|
-
it {
|
69
|
-
it {
|
70
|
+
it { should eq(other) }
|
71
|
+
it { should eql(other) }
|
70
72
|
it { expect(resource.hash).to eq(other.hash) }
|
71
73
|
it('makes their array unique') { expect([resource, other].uniq).to eq([resource]) }
|
72
74
|
end
|
73
75
|
|
74
76
|
describe 'two resources with different sha' do
|
75
|
-
let(:other)
|
77
|
+
let(:other) do
|
78
|
+
Percy::Client::Resource.new('/some-content', sha: sha.reverse, mimetype: mimetype)
|
79
|
+
end
|
76
80
|
|
77
|
-
it {
|
78
|
-
it {
|
79
|
-
it { expect(resource.hash).
|
81
|
+
it { should_not eq(other) }
|
82
|
+
it { should_not eql(other) }
|
83
|
+
it { expect(resource.hash).to_not eq(other.hash) }
|
80
84
|
it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
|
81
85
|
end
|
82
86
|
|
83
87
|
describe 'two resources with different url' do
|
84
|
-
let(:other)
|
88
|
+
let(:other) do
|
89
|
+
Percy::Client::Resource.new('/different-content', sha: sha, mimetype: mimetype)
|
90
|
+
end
|
85
91
|
|
86
|
-
it {
|
87
|
-
it {
|
88
|
-
it { expect(resource.hash).
|
92
|
+
it { should_not eq(other) }
|
93
|
+
it { should_not eql(other) }
|
94
|
+
it { expect(resource.hash).to_not eq(other.hash) }
|
89
95
|
it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
|
90
96
|
end
|
91
97
|
|
92
98
|
describe 'two resources with different mimetype' do
|
93
|
-
let(:other) {
|
99
|
+
let(:other) { Percy::Client::Resource.new('/some-content', sha: sha, mimetype: 'text/css') }
|
94
100
|
|
95
|
-
it {
|
96
|
-
it {
|
97
|
-
it { expect(resource.hash).
|
101
|
+
it { should_not eq(other) }
|
102
|
+
it { should_not eql(other) }
|
103
|
+
it { expect(resource.hash).to_not eq(other.hash) }
|
98
104
|
it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
|
99
105
|
end
|
100
106
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: percy-style
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: ''
|
126
140
|
email:
|
127
141
|
- team@percy.io
|
@@ -132,7 +146,6 @@ files:
|
|
132
146
|
- ".gitignore"
|
133
147
|
- ".rspec"
|
134
148
|
- ".rubocop.yml"
|
135
|
-
- ".rubocop_todo.yml"
|
136
149
|
- ".travis.yml"
|
137
150
|
- Gemfile
|
138
151
|
- Guardfile
|
@@ -189,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
202
|
version: '0'
|
190
203
|
requirements: []
|
191
204
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
205
|
+
rubygems_version: 2.6.12
|
193
206
|
signing_key:
|
194
207
|
specification_version: 4
|
195
208
|
summary: Percy::Client
|
data/.rubocop_todo.yml
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-02-11 20:36:15 -0800 using RuboCop version 0.47.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
Lint/EmptyWhen:
|
11
|
-
Exclude:
|
12
|
-
- 'lib/percy/client/environment.rb'
|
13
|
-
|
14
|
-
# Offense count: 13
|
15
|
-
Metrics/AbcSize:
|
16
|
-
Max: 65
|
17
|
-
|
18
|
-
# Offense count: 24
|
19
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
20
|
-
Metrics/BlockLength:
|
21
|
-
Max: 450
|
22
|
-
|
23
|
-
# Offense count: 10
|
24
|
-
Metrics/CyclomaticComplexity:
|
25
|
-
Max: 14
|
26
|
-
|
27
|
-
# Offense count: 1
|
28
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
-
# URISchemes: http, https
|
30
|
-
Metrics/LineLength:
|
31
|
-
Max: 101
|
32
|
-
|
33
|
-
# Offense count: 14
|
34
|
-
# Configuration parameters: CountComments.
|
35
|
-
Metrics/MethodLength:
|
36
|
-
Max: 57
|
37
|
-
|
38
|
-
# Offense count: 1
|
39
|
-
# Configuration parameters: CountComments.
|
40
|
-
Metrics/ModuleLength:
|
41
|
-
Max: 220
|
42
|
-
|
43
|
-
# Offense count: 6
|
44
|
-
Metrics/PerceivedComplexity:
|
45
|
-
Max: 13
|
46
|
-
|
47
|
-
# Offense count: 4
|
48
|
-
RSpec/AnyInstance:
|
49
|
-
Exclude:
|
50
|
-
- 'spec/lib/percy/client/builds_spec.rb'
|
51
|
-
- 'spec/lib/percy/client/snapshots_spec.rb'
|
52
|
-
|
53
|
-
# Offense count: 113
|
54
|
-
# Configuration parameters: SkipBlocks.
|
55
|
-
RSpec/DescribedClass:
|
56
|
-
Exclude:
|
57
|
-
- 'spec/lib/percy/client/environment_spec.rb'
|
58
|
-
- 'spec/lib/percy/client_spec.rb'
|
59
|
-
- 'spec/lib/percy_spec.rb'
|
60
|
-
|
61
|
-
# Offense count: 22
|
62
|
-
# Configuration parameters: Max.
|
63
|
-
RSpec/ExampleLength:
|
64
|
-
Exclude:
|
65
|
-
- 'spec/lib/percy/client/builds_spec.rb'
|
66
|
-
- 'spec/lib/percy/client/connection_spec.rb'
|
67
|
-
- 'spec/lib/percy/client/environment_spec.rb'
|
68
|
-
- 'spec/lib/percy/client/resources_spec.rb'
|
69
|
-
- 'spec/lib/percy/client/snapshots_spec.rb'
|
70
|
-
- 'spec/lib/percy/config_spec.rb'
|
71
|
-
- 'spec/lib/percy_spec.rb'
|
72
|
-
|
73
|
-
# Offense count: 20
|
74
|
-
# Configuration parameters: SupportedStyles.
|
75
|
-
# SupportedStyles: implicit, each, example
|
76
|
-
RSpec/HookArgument:
|
77
|
-
EnforcedStyle: each
|
78
|
-
|
79
|
-
# Offense count: 8
|
80
|
-
# Configuration parameters: AssignmentOnly.
|
81
|
-
RSpec/InstanceVariable:
|
82
|
-
Exclude:
|
83
|
-
- 'spec/lib/percy/client/environment_spec.rb'
|
84
|
-
|
85
|
-
# Offense count: 27
|
86
|
-
RSpec/MultipleExpectations:
|
87
|
-
Max: 10
|
88
|
-
|
89
|
-
# Offense count: 12
|
90
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
91
|
-
# SupportedStyles: not_to, to_not
|
92
|
-
RSpec/NotToNot:
|
93
|
-
Exclude:
|
94
|
-
- 'spec/lib/percy/client/builds_spec.rb'
|
95
|
-
- 'spec/lib/percy/client/environment_spec.rb'
|
96
|
-
- 'spec/lib/percy_spec.rb'
|
97
|
-
|
98
|
-
# Offense count: 1
|
99
|
-
Style/MethodMissing:
|
100
|
-
Exclude:
|
101
|
-
- 'lib/percy.rb'
|