Class: XcodeResultBundleProcessor::TarballResultsBundle

Inherits:
Object
  • Object
show all
Defined in:
lib/xcoderesultbundleprocessor/results_bundle.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ TarballResultsBundle

Returns a new instance of TarballResultsBundle.



21
22
23
24
25
# File 'lib/xcoderesultbundleprocessor/results_bundle.rb', line 21

def initialize(path)
  file = File.new(path)
  zip  = Zlib::GzipReader.new(file)
  @tar = Gem::Package::TarReader.new(zip)
end

Instance Method Details

#copy_file(source, destination) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/xcoderesultbundleprocessor/results_bundle.rb', line 37

def copy_file(source, destination)
  @tar.seek("./#{source}") do |source_entry|
    File.open(destination, 'w') do |destination_file|
      destination_file.write(source_entry.read)
    end
  end
end

#open_file(path, &block) ⇒ Object



33
34
35
# File 'lib/xcoderesultbundleprocessor/results_bundle.rb', line 33

def open_file(path, &block)
  @tar.seek("./#{path}", &block)
end

#read_plist(path) ⇒ Object



27
28
29
30
31
# File 'lib/xcoderesultbundleprocessor/results_bundle.rb', line 27

def read_plist(path)
  @tar.seek("./#{path}") do |plist_entry|
    CFPropertyList.native_types(CFPropertyList::List.new(data: plist_entry.read).value)
  end
end