class FIR::Parser::Ipa

Public Class Methods

new(path) click to toggle source
# File lib/fir/util/parser/ipa.rb, line 10
def initialize(path)
  @path = path
end

Public Instance Methods

app() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 14
def app
  @app ||= App.new(app_path, is_stored)
end
app_path() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 18
def app_path
  @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first
end
cleanup() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 22
def cleanup
  return unless @contents
  FileUtils.rm_rf(@contents)
  @contents = nil
end
contents() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 45
def contents
  return if @contents
  @contents = "#{Dir.tmpdir}/ipa_files-#{Time.now.to_i}"

  Zip::File.open(@path) do |zip_file|
    zip_file.each do |f|
      f_path = File.join(@contents, f.name)
      FileUtils.mkdir_p(File.dirname(f_path))
      zip_file.extract(f, f_path) unless File.exist?(f_path)
    end
  end

  @contents
end
has_metadata?() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 33
def has_metadata?
  File.file?(metadata_path)
end
is_stored() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 41
def is_stored
  has_metadata? ? true : false
end
metadata() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 28
def metadata
  return unless has_metadata?
  @metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: metadata_path).value)
end
metadata_path() click to toggle source
# File lib/fir/util/parser/ipa.rb, line 37
def metadata_path
  @metadata_path ||= File.join(@contents, 'iTunesMetadata.plist')
end