Module: XcodeResultBundleProcessor::LogDeserializer

Includes:
Methadone::CLILogging
Defined in:
lib/xcoderesultbundleprocessor/log_deserializer.rb

Class Method Summary collapse

Class Method Details

.deserialize_action_logs(results_bundle) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/xcoderesultbundleprocessor/log_deserializer.rb', line 5

def self.deserialize_action_logs(results_bundle)

  plist = results_bundle.read_plist('Info.plist')

  action       = plist['Actions'].first
  log_pathname = action['ActionResult']['LogPath']
  results_bundle.open_file(log_pathname) do |activity_log_io|
    io     = Zlib::GzipReader.new(activity_log_io)
    tokens = SLF0::Tokenizer.read_token_stream(io)
    tokens = SLF0::ClassNameResolver.resolve_class_names(tokens).to_a

    # SLF0 files have a random int at the beginning; don't know its significance
    tokens.shift

    section = SLF0::Deserializer.deserialize(tokens)
    debug section.ai

    ActivityLogFormatter.format(section.subsections.first)
  end
end