lib/travis/client/artifact.rb in travis-1.8.12.pre.rc1 vs lib/travis/client/artifact.rb in travis-1.8.12.travis.1101.9

- old
+ new

@@ -1,9 +1,8 @@ # encoding: utf-8 require 'travis/client' require 'travis/tools/safe_string' -require 'ostruct' module Travis module Client class Artifact < Entity CHUNKED = "application/json; chunked=true; version=2, application/json; version=2" @@ -43,19 +42,15 @@ log = session.get_raw("jobs/#{job_id}/log", nil, "Accept" => TEXT) body = String === log ? log : log['log']['body'] end body end - rescue NoMethodError => e - # Most likely `#load_attribute` failed because the logs have already - # been archived and API returned a bare string, so we will use that instead - session.get_raw("logs/#{id}", nil, "Accept" => TEXT) end def body(stream = block_given?) return current_body unless block_given? or stream - return yield(current_body) unless stream and raw_job.pending? + 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 @@ -81,20 +76,9 @@ end end def pusher_entity job - end - - # wrapper to rescue errors while constructing the job object - # https://github.com/travis-ci/travis.rb/issues/578 - def raw_job - job - rescue - # Exception arises because the logs have been archived, so in this case - # the job is obviously no longer pending. This is the only call we have - # to stub - OpenStruct.new(:pending? => false) end one :log many :logs aka :artifact