percy-client 1.13.10 → 1.14.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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3525d66c956ecb360fe87f8a01fe706140001884cc99ffbf4a14c8c7d7e28e0c
|
4
|
+
data.tar.gz: f5dd3fce2efc074b53f06c5d7d2dc36f85825d4f5d369dcc3489ee79eb993354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522007786801cb6df041e4fdf7daf01849f8657fbfd4d1d55929b64c61dc30f4429c314c1b01b914733baa7b5afad7a8ecd8a9302825813526d52da469a0c90a
|
7
|
+
data.tar.gz: 8d9a03daa93f8c778160b77f2c46dd7925d185be3519d33470196593d7bd1460eeca62ee9dc778ca70e4cd638a35ae82f23d2e15f6ab300115a74f75bc02bf74
|
data/lib/percy/client/builds.rb
CHANGED
@@ -6,6 +6,8 @@ module Percy
|
|
6
6
|
Percy::Client::Environment.pull_request_number
|
7
7
|
commit_data = options[:commit_data] || Percy::Client::Environment.commit
|
8
8
|
target_branch = options[:target_branch] || Percy::Client::Environment.target_branch
|
9
|
+
target_commit_sha = options[:target_commit_sha] \
|
10
|
+
|| Percy::Client::Environment.target_commit_sha
|
9
11
|
resources = options[:resources]
|
10
12
|
parallel_nonce = options[:parallel_nonce] || Percy::Client::Environment.parallel_nonce
|
11
13
|
parallel_total_shards = options[:parallel_total_shards] \
|
@@ -26,6 +28,7 @@ module Percy
|
|
26
28
|
'attributes' => {
|
27
29
|
'branch' => commit_data[:branch],
|
28
30
|
'target-branch' => target_branch,
|
31
|
+
'target-commit-sha' => target_commit_sha,
|
29
32
|
'commit-sha' => commit_data[:sha],
|
30
33
|
'commit-committed-at' => commit_data[:committed_at],
|
31
34
|
'commit-author-name' => commit_data[:author_name],
|
@@ -105,6 +105,10 @@ module Percy
|
|
105
105
|
output
|
106
106
|
end
|
107
107
|
|
108
|
+
def self.target_commit_sha
|
109
|
+
return ENV['PERCY_TARGET_COMMIT'] if ENV['PERCY_TARGET_COMMIT']
|
110
|
+
end
|
111
|
+
|
108
112
|
# The name of the current branch.
|
109
113
|
def self.branch
|
110
114
|
return ENV['PERCY_BRANCH'] if ENV['PERCY_BRANCH']
|
data/lib/percy/client/version.rb
CHANGED
@@ -14,6 +14,7 @@ RSpec.describe Percy::Client::Builds, :vcr do
|
|
14
14
|
'attributes' => {
|
15
15
|
'branch' => kind_of(String),
|
16
16
|
'target-branch' => nil,
|
17
|
+
'target-commit-sha' => nil,
|
17
18
|
'commit-sha' => kind_of(String),
|
18
19
|
'commit-committed-at' => kind_of(String),
|
19
20
|
'commit-author-name' => kind_of(String),
|
@@ -61,6 +62,7 @@ RSpec.describe Percy::Client::Builds, :vcr do
|
|
61
62
|
before(:each) do
|
62
63
|
ENV['PERCY_BRANCH'] = 'foo-branch'
|
63
64
|
ENV['PERCY_TARGET_BRANCH'] = 'bar-branch'
|
65
|
+
ENV['PERCY_TARGET_COMMIT'] = 'test-target-commit'
|
64
66
|
ENV['PERCY_PULL_REQUEST'] = '123'
|
65
67
|
ENV['PERCY_PARALLEL_NONCE'] = 'nonce'
|
66
68
|
ENV['PERCY_PARALLEL_TOTAL'] = '4'
|
@@ -69,6 +71,7 @@ RSpec.describe Percy::Client::Builds, :vcr do
|
|
69
71
|
after(:each) do
|
70
72
|
ENV['PERCY_BRANCH'] = nil
|
71
73
|
ENV['PERCY_TARGET_BRANCH'] = nil
|
74
|
+
ENV['PERCY_TARGET_COMMIT'] = nil
|
72
75
|
ENV['PERCY_PULL_REQUEST'] = nil
|
73
76
|
ENV['PERCY_PARALLEL_NONCE'] = nil
|
74
77
|
ENV['PERCY_PARALLEL_TOTAL'] = nil
|
@@ -85,6 +88,7 @@ RSpec.describe Percy::Client::Builds, :vcr do
|
|
85
88
|
'attributes' => {
|
86
89
|
'branch' => 'foo-branch',
|
87
90
|
'target-branch' => 'bar-branch',
|
91
|
+
'target-commit-sha' => 'test-target-commit',
|
88
92
|
'commit-sha' => kind_of(String),
|
89
93
|
'commit-committed-at' => kind_of(String),
|
90
94
|
'commit-author-name' => kind_of(String),
|
@@ -3,6 +3,7 @@ RSpec.describe Percy::Client::Environment do
|
|
3
3
|
# Unset Percy vars.
|
4
4
|
ENV['PERCY_COMMIT'] = nil
|
5
5
|
ENV['PERCY_BRANCH'] = nil
|
6
|
+
ENV['PERCY_TARGET_COMMIT'] = nil
|
6
7
|
ENV['PERCY_TARGET_BRANCH'] = nil
|
7
8
|
ENV['PERCY_PULL_REQUEST'] = nil
|
8
9
|
ENV['PERCY_PROJECT'] = nil
|
@@ -145,6 +146,17 @@ RSpec.describe Percy::Client::Environment do
|
|
145
146
|
end
|
146
147
|
end
|
147
148
|
|
149
|
+
describe '#target_commit_sha' do
|
150
|
+
it 'returns nil if unset' do
|
151
|
+
expect(Percy::Client::Environment.target_commit_sha).to be_nil
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'can be set with PERCY_TARGET_COMMIT' do
|
155
|
+
ENV['PERCY_TARGET_COMMIT'] = 'test-target-commit'
|
156
|
+
expect(Percy::Client::Environment.target_commit_sha).to eq('test-target-commit')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
148
160
|
describe '#pull_request_number' do
|
149
161
|
it 'returns nil if no CI environment' do
|
150
162
|
expect(Percy::Client::Environment.pull_request_number).to be_nil
|
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.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.6
|
206
|
+
rubygems_version: 2.7.6
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Percy::Client
|