travis 1.6.3.travis.388.4 → 1.6.3.travis.389.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDc5NjczYzZhZWNiMzNmY2NhMDE3MzBhYjg3MDlhNzRlMjNlMWVkYw==
4
+ NDQyYTc2Yzg0M2M5YTQ4NmY5ZWQwY2JmMTdlZmYyY2VjOTU4NWFmYg==
5
5
  data.tar.gz: !binary |-
6
- YTQ2ZDBmNmQ1OWFjYTE3NGVkNGJkNDBlYjA4NGQ4NmI3MjRkOWU0Mg==
6
+ M2ZkM2I4ZTRjMzA4ZTdjNzA0ZGM1NTJlYzA0MTQxZmMxYzZiM2QzZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2RlMjE5YWMwM2U2MTNkZjVjZmFlMTVjYWZmMGI4ZmQ1NWU3YTY2ZjJkNzRi
10
- Y2NkOGNhYzVhMDg4ZjA5NDYwNDVhMzk4NjkzZmU0NWI3ODc1ZmZmNDQ4NjVj
11
- ZmZmOGZkNDU4ZTFhY2E3MzcxZDIwYjNmNTdhMDI2OTRlYTI3ZjM=
9
+ YzY0YzRiNTk2YzY0N2Q2ZTY4N2NjYWJmZjcxMTgyZGU1NjljZTI2ZTA5ZmQ1
10
+ YzI1ZmVjMTlmNmZhMDQ5ZGIxZTc0OTUwNTIwMzhjNWQ4YzliNzc1N2IxNWJk
11
+ NTkyNDQ4OTI5ZGYxZWY4MGI0YTMxOTUyNWE0N2FhODdjZDEyNzA=
12
12
  data.tar.gz: !binary |-
13
- MmE5OTVlYmVlYTQ1YTg2MTM0M2ZmYTA4MjY5NWY3Y2QxMDNlMDlmM2NlNmE5
14
- YzgyMjU4MDg0OTM1ZTgzZDE3MjdiZDlkNDFlZjgzOWYzNjIwMmY3MWE1OGMz
15
- NGI2NThmNWI1MTUyZmVkOWRmNjdmZWI3ZDU3NzBhYzY4ODllNDg=
13
+ ZDU1MTM4YjZjZGQ0NDI3NDViNDhmMDdlNWNiOTliYzk2MjM0MTk4NWQ4MWY4
14
+ OGVlYmUxMzViODg5Mjk0Zjg0YmJkZDRkOTI3OGNlYzJmNmI4YzYzNjNkM2Vi
15
+ NDU0ZjllMTExZGFkZGY2NDU2MzhlYWE4MjJkZjA4OWYzNzljMTM=
@@ -25,9 +25,16 @@ module Travis
25
25
  attributes['clean_body'] ||= Tools::SafeString.clean(body)
26
26
  end
27
27
 
28
+ def current_body
29
+ attributes['current_body'] ||= begin
30
+ body = load_attribute('body')
31
+ body.to_s.empty? ? session.get_raw("jobs/#{job_id}/log") : body
32
+ end
33
+ end
34
+
28
35
  def body(stream = block_given?)
29
- return load_attribute('body') unless block_given? or stream
30
- return yield(load_attribute('body')) unless stream and job.pending?
36
+ return current_body unless block_given? or stream
37
+ return yield(current_body) unless stream and job.pending?
31
38
  number = 0
32
39
 
33
40
  session.listen(self) do |listener|
@@ -56,9 +56,6 @@ module Travis
56
56
  clear_cache!
57
57
  self.connection = Faraday.new(:url => uri, :ssl => ssl) do |faraday|
58
58
  faraday.request :url_encoded
59
- faraday.response :json
60
- faraday.response :follow_redirects
61
- faraday.response :raise_error
62
59
  faraday.adapter(*faraday_adapter)
63
60
  end
64
61
  end
@@ -173,11 +170,23 @@ module Travis
173
170
 
174
171
  def raw(verb, url, *args)
175
172
  url = url.sub(/^\//, '')
176
- result = instrumented(verb.to_s.upcase, url, *args) { connection.public_send(verb, url, *args) }
177
- raise Travis::Client::Error, 'SSL error: could not verify peer' if result.status == 0
178
- result.body
179
- rescue Faraday::Error::ClientError => e
180
- handle_error(e)
173
+ result = instrumented(verb.to_s.upcase, url, *args) do
174
+ connection.public_send(verb, url, *args) do |request|
175
+ next if request.path !~ /^https?:/ or request.path.start_with? api_endpoint
176
+ request.headers.delete("Authorization")
177
+ end
178
+ end
179
+
180
+ case result.status
181
+ when 0 then raise Travis::Client::Error, 'SSL error: could not verify peer'
182
+ when 200..299 then JSON.parse(result.body) rescue result.body
183
+ when 301, 303 then raw(:get, result.headers['Location'])
184
+ when 302, 307, 308 then raw(verb, result.headers['Location'])
185
+ when 404 then raise Travis::Client::NotFound, result.body
186
+ when 400..499 then raise Travis::Client::Error, result.status
187
+ when 500..599 then raise Travis::Client::Error, "server error (#{result.status})"
188
+ else raise Travis::Client::Error, "unhandled status code #{result.status}"
189
+ end
181
190
  end
182
191
 
183
192
  def inspect
@@ -240,12 +249,6 @@ module Travis
240
249
  entity
241
250
  end
242
251
 
243
- def handle_error(e)
244
- klass = Travis::Client::NotFound if e.is_a? Faraday::Error::ResourceNotFound
245
- klass ||= Travis::Client::Error
246
- raise klass, error_message(e), e.backtrace
247
- end
248
-
249
252
  def error_message(e)
250
253
  message = e.response[:body].to_str rescue e.message
251
254
  JSON.parse(message).fetch('error').fetch('message') rescue message
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.3.travis.388.4
4
+ version: 1.6.3.travis.389.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -29,7 +29,7 @@ authors:
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2013-11-23 00:00:00.000000000 Z
32
+ date: 2013-11-24 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: faraday