percy-client 0.4.1 → 0.5.0

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
  SHA1:
3
- metadata.gz: b77cc5b3d6934f0d5ae65fe77be6006fc7cea316
4
- data.tar.gz: 64e9806cca35ed3b682ffed4862b07018be69b68
3
+ metadata.gz: e75bc0f2c8c81c6760bd43294b467c232a257c2c
4
+ data.tar.gz: c99b03e4396aa30c6e012ed1e5c629bd44761f14
5
5
  SHA512:
6
- metadata.gz: 912a22c69f42b9101c10a9bf421dba748eaaeb934fc54d70672b74c2dd29f8087c2c8a723815c38cb72ed4f772574555ae9dcb724ae194ef2777b809515259d2
7
- data.tar.gz: e24d0d6babfc0df3aaf55d0f755aad44d95c3709996961adb3d83c6e96ec110f3c61b819205410346954089d2b37738e33cf38f104a38d0cae361fd459c14c9a
6
+ metadata.gz: f5f5412f33c7f120d0c12a2450fba57220c2a7a6a393977c5d8642346b02b265732b77fc8915257a3708dd94063715582b71c86654001355d8acecf41769a8f0
7
+ data.tar.gz: 7808a2f4b246321aa6eb42e44999eda094e05d6479823facaf85e2d0a6a7d31ddc785cae0cfaa750d5d4a2c3d0432700dcddeb698932cacecfed56413d7e1b42
@@ -20,6 +20,7 @@ module Percy
20
20
  return :jenkins if ENV['JENKINS_URL'] && ENV['ghprbPullId'] # Pull Request Builder plugin.
21
21
  return :circle if ENV['CIRCLECI']
22
22
  return :codeship if ENV['CI_NAME'] && ENV['CI_NAME'] == 'codeship'
23
+ return :drone if ENV['DRONE'] == 'true'
23
24
  end
24
25
 
25
26
  # @return [Hash] All commit data from the current commit. Might be empty if commit data could
@@ -65,6 +66,8 @@ module Percy
65
66
  ENV['CIRCLE_SHA1']
66
67
  when :codeship
67
68
  ENV['CI_COMMIT_ID']
69
+ when :drone
70
+ ENV['DRONE_COMMIT']
68
71
  end
69
72
  end
70
73
 
@@ -89,6 +92,8 @@ module Percy
89
92
  ENV['CIRCLE_BRANCH']
90
93
  when :codeship
91
94
  ENV['CI_BRANCH']
95
+ when :drone
96
+ ENV['DRONE_BRANCH']
92
97
  else
93
98
  _raw_branch_output
94
99
  end
@@ -146,6 +151,8 @@ module Percy
146
151
  end
147
152
  when :codeship
148
153
  # Unfortunately, codeship always returns 'false' for CI_PULL_REQUEST. For now, return nil.
154
+ when :drone
155
+ ENV['CI_PULL_REQUEST']
149
156
  end
150
157
  end
151
158
 
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  class Client
3
- VERSION = '0.4.1'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -32,6 +32,13 @@ RSpec.describe Percy::Client::Environment do
32
32
  ENV['CI_BRANCH'] = nil
33
33
  ENV['CI_PULL_REQUEST'] = nil
34
34
  ENV['CI_COMMIT_ID'] = nil
35
+
36
+ # Unset Drone vars.
37
+ ENV['CI'] = nil
38
+ ENV['DRONE'] = nil
39
+ ENV['DRONE_COMMIT'] = nil
40
+ ENV['DRONE_BRANCH'] = nil
41
+ ENV['CI_PULL_REQUEST'] = nil
35
42
  end
36
43
 
37
44
  before(:each) do
@@ -273,6 +280,40 @@ RSpec.describe Percy::Client::Environment do
273
280
  end
274
281
  end
275
282
  end
283
+ context 'in Drone' do
284
+ before(:each) do
285
+ ENV['DRONE'] = 'true'
286
+ ENV['DRONE_COMMIT'] = 'drone-commit-sha'
287
+ ENV['DRONE_BRANCH'] = 'drone-branch'
288
+ ENV['CI_PULL_REQUEST'] = '123'
289
+ end
290
+
291
+ describe '#current_ci' do
292
+ it 'is :drone' do
293
+ expect(Percy::Client::Environment.current_ci).to eq(:drone)
294
+ end
295
+ end
296
+ describe '#branch' do
297
+ it 'reads from the CI environment' do
298
+ expect(Percy::Client::Environment.branch).to eq('drone-branch')
299
+ end
300
+ end
301
+ describe '#_commit_sha' do
302
+ it 'reads from the CI environment' do
303
+ expect(Percy::Client::Environment._commit_sha).to eq('drone-commit-sha')
304
+ end
305
+ end
306
+ describe '#pull_request_number' do
307
+ it 'reads from the CI environment' do
308
+ expect(Percy::Client::Environment.pull_request_number).to eq('123')
309
+ end
310
+ end
311
+ describe '#repo' do
312
+ it 'returns the current local repo name' do
313
+ expect(Percy::Client::Environment.repo).to eq('percy/percy-client')
314
+ end
315
+ end
316
+ end
276
317
  describe 'local git repo methods' do
277
318
  describe '#commit' do
278
319
  it 'returns current local commit data' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.