travis 1.6.18.travis.609.5 → 1.6.18.travis.610.5
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 +8 -8
- data/assets/travis.sh +3 -3
- data/examples/cli/private_dependencies.md +12 -12
- data/lib/travis/cli/command.rb +6 -0
- data/lib/travis/client/error.rb +21 -0
- data/lib/travis/client/session.rb +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZGQwODc4OGQ3OWJjYzFlZTdjMWNmNDQ5Y2MyYWJiZGM0YzYzMTZmZg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
ZGU0NzhiYjZjMTdhZmFlZjI4ZWQ2YWE1NTAyNGYxODE3NjJmZmY5Yw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
N2E5YTlkN2NlOWYzYmJhMTZhNWY2NjVjMTQyZmMyM2QxNjJiYThkNzg0MzFj
|
|
10
|
+
YjEwZjRlMWExMWZmYWRlODFjZWRlZjczN2ZmMmJlYjA2Mzc5NWY2ZTdiM2Iz
|
|
11
|
+
ODZjNzg4MzYwOWFlYmE2ODUzNGIzZTEzMmYwNjE2MjFjMjZhZDQ=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MmE3ZGViODc4ODRmZGQ1MTY3OTgyMGE0MGRmZmViMmYxOTRkYmM1NmUxM2E5
|
|
14
|
+
M2YwMDZlNGUxZGE1ODU5MTFlYmUxOTc3ZTA3MzM1NDczYTdiNDE5MjYxZjVh
|
|
15
|
+
MzYxOWEzMTMyZjY1ZTFjOWE5OWVkODExN2M4OWIzYWUwZGNmODk=
|
data/assets/travis.sh
CHANGED
|
@@ -46,7 +46,7 @@ if type compdef 1>/dev/null 2>/dev/null; then
|
|
|
46
46
|
logs) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-d[remove logs]" "--delete[remove logs]" "-f[do not ask user to confirm deleting the logs]" "--force[do not ask user to confirm deleting the logs]" "--stream[only print current logs, do not stream]" "--no-stream[only print current logs, do not stream]" '*:file:_files' && return 0;;
|
|
47
47
|
monitor) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-m[Only monitor my own repositories]" "--my-repos[Only monitor my own repositories]" "-r[monitor given repository (can be used more than once)]" "--repo[monitor given repository (can be used more than once)]" "-n[send out desktop notifications (optional type: osx, growl, libnotify)]" "--notify[send out desktop notifications (optional type: osx, growl, libnotify)]" "--no-notify[send out desktop notifications (optional type: osx, growl, libnotify)]" "-b[only monitor builds, not jobs]" "--builds[only monitor builds, not jobs]" "-p[monitor push events]" "--push[monitor push events]" "-P[monitor pull request events]" "--pull[monitor pull request events]" '*:file:_files' && return 0;;
|
|
48
48
|
open) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-g[Open the corresponding project, compare view or pull request on GitHub]" "--github[Open the corresponding project, compare view or pull request on GitHub]" "-p[Print out the URL instead of opening it in a browser]" "--print[Print out the URL instead of opening it in a browser]" '*:file:_files' && return 0;;
|
|
49
|
-
pubkey) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-p[encode in format used by pem]" "--pem[encode in format used by pem]" "
|
|
49
|
+
pubkey) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-p[encode in format used by pem]" "--pem[encode in format used by pem]" "-f[display fingerprint]" "--fingerprint[display fingerprint]" '*:file:_files' && return 0;;
|
|
50
50
|
raw) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "--json[display as json]" "--no-json[display as json]" '*:file:_files' && return 0;;
|
|
51
51
|
report) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[include repositories in report]" "--known-repos[include repositories in report]" '*:file:_files' && return 0;;
|
|
52
52
|
repos) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-m[only list repositories matching the given pattern (shell style)]" "--match[only list repositories matching the given pattern (shell style)]" "-o[only list repos for a certain owner]" "--owner[only list repos for a certain owner]" "-n[only list repos with a given name]" "--name[only list repos with a given name]" "-a[only list active repositories]" "--active[only list active repositories]" "-A[only list inactive repositories]" "--inactive[only list inactive repositories]" "-d[only list repos with (or without) admin access]" "--admin[only list repos with (or without) admin access]" "-D[only list repos without admin access]" "--no-admin[only list repos without admin access]" '*:file:_files' && return 0;;
|
|
@@ -93,7 +93,7 @@ elif type compctl 1>/dev/null 2>/dev/null; then
|
|
|
93
93
|
logs) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--delete" "-d" "--force" "-f" "--stream" "--no-stream");;
|
|
94
94
|
monitor) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--my-repos" "-m" "--repo" "-r" "--notify" "--no-notify" "-n" "--builds" "-b" "--push" "-p" "--pull" "-P");;
|
|
95
95
|
open) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--github" "-g" "--print" "-p");;
|
|
96
|
-
pubkey) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--pem" "
|
|
96
|
+
pubkey) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--pem" "-p" "--fingerprint" "-f");;
|
|
97
97
|
raw) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--json" "--no-json");;
|
|
98
98
|
report) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--known-repos" "-r");;
|
|
99
99
|
repos) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--match" "-m" "--owner" "-o" "--name" "-n" "--active" "-a" "--inactive" "-A" "--admin" "-d" "--no-admin" "-D");;
|
|
@@ -141,7 +141,7 @@ elif type complete 1>/dev/null 2>/dev/null; then
|
|
|
141
141
|
logs) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --store-repo -R --delete -d --force -f --stream --no-stream";;
|
|
142
142
|
monitor) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --my-repos -m --repo -r --notify --no-notify -n --builds -b --push -p --pull -P";;
|
|
143
143
|
open) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --store-repo -R --github -g --print -p";;
|
|
144
|
-
pubkey) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --store-repo -R --pem
|
|
144
|
+
pubkey) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --store-repo -R --pem -p --fingerprint -f";;
|
|
145
145
|
raw) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --json --no-json";;
|
|
146
146
|
report) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --known-repos -r";;
|
|
147
147
|
repos) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --match -m --owner -o --name -n --active -a --inactive -A --admin -d --no-admin -D";;
|
|
@@ -179,14 +179,14 @@ gemspec
|
|
|
179
179
|
|
|
180
180
|
if ENV['CI']
|
|
181
181
|
# use HTTPS with password on Travis CI
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
git_source :github do |repo_name|
|
|
183
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
|
184
|
+
"https://ci-user:#{ENV.fetch("CI_USER_PASSWORD")}@github.com/#{repo_name}.git"
|
|
185
|
+
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
-
gem 'lib1',
|
|
189
|
-
gem 'lib2',
|
|
188
|
+
gem 'lib1', github: "myorg/lib1"
|
|
189
|
+
gem 'lib2', github: "myorg/lib2"
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
### API token
|
|
@@ -231,14 +231,14 @@ gemspec
|
|
|
231
231
|
|
|
232
232
|
if ENV['CI']
|
|
233
233
|
# use HTTPS with token on Travis CI
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
git_source :github do |repo_name|
|
|
235
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
|
236
|
+
"https://#{ENV.fetch("CI_USER_TOKEN")}@github.com/#{repo_name}.git"
|
|
237
|
+
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
-
gem 'lib1',
|
|
241
|
-
gem 'lib2',
|
|
240
|
+
gem 'lib1', github: "myorg/lib1"
|
|
241
|
+
gem 'lib2', github: "myorg/lib2"
|
|
242
242
|
```
|
|
243
243
|
|
|
244
244
|
### Dedicated User Account
|
data/lib/travis/cli/command.rb
CHANGED
|
@@ -201,6 +201,12 @@ module Travis
|
|
|
201
201
|
rescue Travis::Client::NotLoggedIn => e
|
|
202
202
|
raise(e) if explode?
|
|
203
203
|
error "#{e.message} - try running #{command("login#{endpoint_option}")}"
|
|
204
|
+
rescue Travis::Client::NotFound => e
|
|
205
|
+
raise(e) if explode?
|
|
206
|
+
error "resource not found (#{e.message})"
|
|
207
|
+
rescue Travis::Client::Error => e
|
|
208
|
+
raise(e) if explode?
|
|
209
|
+
error e.message
|
|
204
210
|
rescue StandardError => e
|
|
205
211
|
raise(e) if explode?
|
|
206
212
|
message = e.message
|
data/lib/travis/client/error.rb
CHANGED
|
@@ -10,5 +10,26 @@ module Travis
|
|
|
10
10
|
|
|
11
11
|
class NotLoggedIn < Error
|
|
12
12
|
end
|
|
13
|
+
|
|
14
|
+
class ValidationFailed < Error
|
|
15
|
+
attr_reader :errors
|
|
16
|
+
|
|
17
|
+
def initialize(message = nil, *args)
|
|
18
|
+
message = parse_message(message) if message
|
|
19
|
+
super(message, *args)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def parse_message(message)
|
|
23
|
+
response = JSON.load(message)
|
|
24
|
+
message = response['message'].to_s
|
|
25
|
+
if @errors = response['errors'] and @errors.any?
|
|
26
|
+
readable = @errors.map { |e| "#{e['field']}: #{e['code'].gsub('_', ' ')}" }
|
|
27
|
+
message += " (#{readable.join(', ')})"
|
|
28
|
+
end
|
|
29
|
+
message
|
|
30
|
+
rescue JSON::ParserError
|
|
31
|
+
message
|
|
32
|
+
end
|
|
33
|
+
end
|
|
13
34
|
end
|
|
14
35
|
end
|
|
@@ -213,11 +213,12 @@ module Travis
|
|
|
213
213
|
when 200..299 then JSON.parse(result.body) rescue result.body
|
|
214
214
|
when 301, 303 then raw(:get, result.headers['Location'])
|
|
215
215
|
when 302, 307, 308 then raw(verb, result.headers['Location'])
|
|
216
|
-
when 401 then raise Travis::Client::NotLoggedIn,
|
|
217
|
-
when 403 then raise Travis::Client::NotLoggedIn,
|
|
218
|
-
when 404 then raise Travis::Client::NotFound,
|
|
219
|
-
when
|
|
220
|
-
when
|
|
216
|
+
when 401 then raise Travis::Client::NotLoggedIn, 'not logged in'
|
|
217
|
+
when 403 then raise Travis::Client::NotLoggedIn, 'invalid access token'
|
|
218
|
+
when 404 then raise Travis::Client::NotFound, result.body
|
|
219
|
+
when 422 then raise Travis::Client::ValidationFailed, result.body
|
|
220
|
+
when 400..499 then raise Travis::Client::Error, "%s: %p" % [result.status, result.body]
|
|
221
|
+
when 500..599 then raise Travis::Client::Error, "server error (%s: %p)" % [result.status, result.body]
|
|
221
222
|
else raise Travis::Client::Error, "unhandled status code #{result.status}"
|
|
222
223
|
end
|
|
223
224
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: travis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.18.travis.
|
|
4
|
+
version: 1.6.18.travis.610.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Haase
|
|
@@ -39,7 +39,7 @@ authors:
|
|
|
39
39
|
autorequire:
|
|
40
40
|
bindir: bin
|
|
41
41
|
cert_chain: []
|
|
42
|
-
date: 2014-
|
|
42
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
|
43
43
|
dependencies:
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: faraday
|