Wait for job.id in Travis.Artifact

This commit is contained in:
Piotr Sarnacki 2013-01-29 15:34:58 +01:00
parent 5687f57388
commit 9df79d6944

View File

@ -8,6 +8,7 @@ require 'travis/model'
init: -> init: ->
@_super.apply this, arguments @_super.apply this, arguments
@addObserver 'job.id', @fetchBody
@fetchBody() @fetchBody()
@set 'queue', Ember.A([]) @set 'queue', Ember.A([])
@ -21,8 +22,11 @@ require 'travis/model'
@incrementProperty('version') @incrementProperty('version')
fetchBody: -> fetchBody: ->
if jobId = @get('job.id')
@removeObserver 'job.id', @fetchBody
self = this self = this
Travis.ajax.ajax "/jobs/#{@get('job.id')}/log.txt?cors_hax=true", 'GET', Travis.ajax.ajax "/jobs/#{jobId}/log.txt?cors_hax=true", 'GET',
dataType: 'text' dataType: 'text'
contentType: 'text/plain' contentType: 'text/plain'
success: (data, textStatus, xhr) -> success: (data, textStatus, xhr) ->
@ -31,7 +35,7 @@ require 'travis/model'
# For some reason not all browsers can fetch this header # For some reason not all browsers can fetch this header
unless logUrl unless logUrl
logUrl = self.s3Url("/jobs/#{self.get('job.id')}/log.txt") logUrl = self.s3Url("/jobs/#{jobId}/log.txt")
$.ajax $.ajax
url: logUrl url: logUrl