Class: AppInfo::DSYM::DebugInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/app_info/dsym/debug_info.rb

Overview

DSYM Debug Information Format Struct

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DebugInfo

Returns a new instance of DebugInfo.



11
12
13
# File 'lib/app_info/dsym/debug_info.rb', line 11

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/app_info/dsym/debug_info.rb', line 9

def path
  @path
end

Instance Method Details

#bin_pathString

Returns:

  • (String)


72
73
74
75
76
77
78
# File 'lib/app_info/dsym/debug_info.rb', line 72

def bin_path
  @bin_path ||= lambda {
    dwarf_path = ::File.join(path, 'Contents', 'Resources', 'DWARF')
    name = Dir.children(dwarf_path)[0]
    ::File.join(dwarf_path, name)
  }.call
end

#build_versionString?

Returns:

  • (String, nil)


49
50
51
# File 'lib/app_info/dsym/debug_info.rb', line 49

def build_version
  info.try(:[], 'CFBundleVersion')
end

#identifierString? Also known as: bundle_id

Returns:

  • (String, nil)


54
55
56
# File 'lib/app_info/dsym/debug_info.rb', line 54

def identifier
  info.try(:[], 'CFBundleIdentifier').sub('com.apple.xcode.dsym.', '')
end

#infoCFPropertyList

Returns:

  • (CFPropertyList)


60
61
62
63
64
# File 'lib/app_info/dsym/debug_info.rb', line 60

def info
  return nil unless ::File.exist?(info_path)

  @info ||= CFPropertyList.native_types(CFPropertyList::List.new(file: info_path).value)
end

#info_pathString

Returns:

  • (String)


67
68
69
# File 'lib/app_info/dsym/debug_info.rb', line 67

def info_path
  @info_path ||= ::File.join(path, 'Contents', 'Info.plist')
end

#macho_type::MachO::MachOFile, ::MachO::FatFile

Returns:

  • (::MachO::MachOFile, ::MachO::FatFile)


21
22
23
# File 'lib/app_info/dsym/debug_info.rb', line 21

def macho_type
  @macho_type ||= ::MachO.open(bin_path)
end

#machosArray<AppInfo::DSYM::MachO>

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/app_info/dsym/debug_info.rb', line 26

def machos
  @machos ||= case macho_type
              when ::MachO::MachOFile
                [MachO.new(macho_type, ::File.size(bin_path))]
              else
                size = macho_type.fat_archs.each_with_object([]) do |arch, obj|
                  obj << arch.size
                end

                machos = []
                macho_type.machos.each_with_index do |file, i|
                  machos << MachO.new(file, size[i])
                end
                machos
              end
end

#objectString

Returns:

  • (String)


16
17
18
# File 'lib/app_info/dsym/debug_info.rb', line 16

def object
  @object ||= ::File.basename(bin_path)
end

#release_versionString?

Returns:

  • (String, nil)


44
45
46
# File 'lib/app_info/dsym/debug_info.rb', line 44

def release_version
  info.try(:[], 'CFBundleShortVersionString')
end