percy-client 0.1.5 → 0.1.6

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: 07ab97ad5b889b060f38c6bfda3344133adc9c92
4
- data.tar.gz: a18153dedd45120c932c0ceeefbce61d497d67ef
3
+ metadata.gz: 5a33028c9d1095fa278a831eab73d3a4dba24377
4
+ data.tar.gz: 47d5367105e4d6f870da109f8b83adea38dd6306
5
5
  SHA512:
6
- metadata.gz: d451d0d9b8762beec56b2199a4b9d3e22bce3235d11b8915bb452cd206b2f400e3111bab917db7607ae2349ca4189b2d4f3b1a299ed74e071795e9331aa8048f
7
- data.tar.gz: 512f86bfd854452cc5f9f8957cf30db13ec5a4c54a4b571ec99d98eff5fed3329f2b4d877fd13d97b26d343fd4ba9cb7064eee315cbf6c1d3f444c04efce2a29
6
+ metadata.gz: 631f9deaf5d949ca32d9ba1fb2396433c74616ecba03136006509a935282fa526bf2acc5cd23d204fafec19dadf32ffb69fe778a57935db063f7921ac241d1c5
7
+ data.tar.gz: 6a292d3d959fadf1592f34a8852a2812062ae73a3446b9f3dbf3e71541d0ca983bdfb449557108327424e58b00655beae5e13af3d914cd08b101227d9fa1a4e2
data/README.md CHANGED
@@ -3,32 +3,4 @@
3
3
  [![Build Status](https://travis-ci.org/percy/percy-client.svg?branch=master)](https://travis-ci.org/percy/percy-client)
4
4
  [![Gem Version](https://badge.fury.io/rb/percy-client.svg)](http://badge.fury.io/rb/percy-client)
5
5
 
6
- (in development, coming soon)
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'percy-client'
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install percy-client
23
-
24
- ## Usage
25
-
26
- ...
27
-
28
- ## Contributing
29
-
30
- 1. Fork it ( https://github.com/percy/percy-client/fork )
31
- 2. Create your feature branch (`git checkout -b my-new-feature`)
32
- 3. Commit your changes (`git commit -am 'Add some feature'`)
33
- 4. Push to the branch (`git push origin my-new-feature`)
34
- 5. Create a new Pull Request
6
+ #### Docs here: [https://percy.io/docs/api/client](https://percy.io/docs/api/client)
@@ -20,6 +20,7 @@ module Percy
20
20
  return :travis if ENV['TRAVIS_BUILD_ID']
21
21
  return :jenkins if ENV['JENKINS_URL'] && ENV['ghprbPullId'] # Pull Request Builder plugin.
22
22
  return :circle if ENV['CIRCLECI']
23
+ return :codeship if ENV['CI_NAME'] && ENV['CI_NAME'] == 'codeship'
23
24
  end
24
25
 
25
26
  def self.commit_sha
@@ -32,6 +33,8 @@ module Percy
32
33
  ENV['TRAVIS_COMMIT']
33
34
  when :circle
34
35
  ENV['CIRCLE_SHA1']
36
+ when :codeship
37
+ ENV['CI_COMMIT_ID']
35
38
  else
36
39
  'HEAD'
37
40
  end
@@ -63,6 +66,8 @@ module Percy
63
66
  ENV['TRAVIS_BRANCH']
64
67
  when :circle
65
68
  ENV['CIRCLE_BRANCH']
69
+ when :codeship
70
+ ENV['CI_BRANCH']
66
71
  else
67
72
  # Discover from current git repo branch name.
68
73
  `git rev-parse --abbrev-ref HEAD`.strip
@@ -104,6 +109,8 @@ module Percy
104
109
  if ENV['CI_PULL_REQUESTS'] && ENV['CI_PULL_REQUESTS'] != ''
105
110
  ENV['CI_PULL_REQUESTS'].split(',')[0]
106
111
  end
112
+ when :codeship
113
+ # Unfortunately, codeship always returns 'false' for CI_PULL_REQUEST. For now, return nil.
107
114
  end
108
115
  end
109
116
  end
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  class Client
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ module Percy
28
28
  end
29
29
 
30
30
  def repo
31
- @repo ||= ENV['PERCY_REPO'] || Percy::Client::Environment.repo
31
+ @repo ||= Percy::Client::Environment.repo
32
32
  end
33
33
  end
34
34
  end
@@ -26,6 +26,12 @@ RSpec.describe Percy::Client::Environment do
26
26
  ENV['CIRCLE_PROJECT_USERNAME'] = nil
27
27
  ENV['CIRCLE_PROJECT_REPONAME'] = nil
28
28
  ENV['CI_PULL_REQUESTS'] = nil
29
+
30
+ # Unset Codeship vars.
31
+ ENV['CI_NAME'] = nil
32
+ ENV['CI_BRANCH'] = nil
33
+ ENV['CI_PULL_REQUEST'] = nil
34
+ ENV['CI_COMMIT_ID'] = nil
29
35
  end
30
36
 
31
37
  before(:each) do
@@ -198,6 +204,40 @@ RSpec.describe Percy::Client::Environment do
198
204
  end
199
205
  end
200
206
  end
207
+ context 'in Codeship' do
208
+ before(:each) do
209
+ ENV['CI_NAME'] = 'codeship'
210
+ ENV['CI_BRANCH'] = 'codeship-branch'
211
+ ENV['CI_PULL_REQUEST'] = 'false' # This is always false on Codeship, unfortunately.
212
+ ENV['CI_COMMIT_ID'] = 'codeship-commit-sha'
213
+ end
214
+
215
+ describe '#current_ci' do
216
+ it 'is :codeship' do
217
+ expect(Percy::Client::Environment.current_ci).to eq(:codeship)
218
+ end
219
+ end
220
+ describe '#branch' do
221
+ it 'reads from the CI environment' do
222
+ expect(Percy::Client::Environment.branch).to eq('codeship-branch')
223
+ end
224
+ end
225
+ describe '#commit_sha' do
226
+ it 'reads from the CI environment' do
227
+ expect(Percy::Client::Environment.commit_sha).to eq('codeship-commit-sha')
228
+ end
229
+ end
230
+ describe '#pull_request_number' do
231
+ it 'reads from the CI environment' do
232
+ expect(Percy::Client::Environment.pull_request_number).to be_nil
233
+ end
234
+ end
235
+ describe '#repo' do
236
+ it 'returns the current local repo name' do
237
+ expect(Percy::Client::Environment.repo).to eq('percy/percy-client')
238
+ end
239
+ end
240
+ end
201
241
  describe 'local git repo methods' do
202
242
  describe '#commit' do
203
243
  it 'returns current local commit data' do
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: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-25 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday