lib/travis/client/artifact.rb in travis-1.6.3.travis.388.4 vs lib/travis/client/artifact.rb in travis-1.6.3.travis.389.4

- old
+ new

@@ -23,12 +23,19 @@ def clean_body attributes['clean_body'] ||= Tools::SafeString.clean(body) end + def current_body + attributes['current_body'] ||= begin + body = load_attribute('body') + body.to_s.empty? ? session.get_raw("jobs/#{job_id}/log") : body + end + end + def body(stream = block_given?) - return load_attribute('body') unless block_given? or stream - return yield(load_attribute('body')) unless stream and job.pending? + return current_body unless block_given? or stream + return yield(current_body) unless stream and job.pending? number = 0 session.listen(self) do |listener| listener.on 'job:log' do |event| next unless event.payload['number'] > number