Class: AppInfo::DSYM

Inherits:
File
  • Object
show all
Includes:
Helper::Archive
Defined in:
lib/app_info/dsym.rb,
lib/app_info/dsym/macho.rb,
lib/app_info/dsym/debug_info.rb

Overview

DSYM parser

Defined Under Namespace

Classes: DebugInfo, MachO

Instance Attribute Summary

Attributes inherited from File

#file, #logger

Instance Method Summary collapse

Methods included from Helper::Archive

#tempdir, #unarchive

Methods inherited from File

#device, #format, #initialize, #not_implemented_error!, #platform, #size

Constructor Details

This class inherits a constructor from AppInfo::File

Instance Method Details

#clear!Object



29
30
31
32
33
34
35
36
# File 'lib/app_info/dsym.rb', line 29

def clear!
  return unless @contents

  FileUtils.rm_rf(@contents)

  @contents = nil
  @files = nil
end

#contentsString

Returns contents path of dsym.

Returns:

  • (String)

    contents path of dsym



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/app_info/dsym.rb', line 39

def contents
  @contents ||= lambda {
    return @file if ::File.directory?(@file)

    dsym_filenames = []
    unarchive(@file, prefix: 'dsym') do |base_path, zip_file|
      zip_file.each do |entry|
        file_path = entry.name
        next unless file_path.downcase.include?('.dsym/contents/')
        next if ::File.basename(file_path).start_with?('.')

        dsym_filename = file_path.split('/').select { |f| f.downcase.end_with?('.dsym') }.last
        dsym_filenames << dsym_filename unless dsym_filenames.include?(dsym_filename)

        unless file_path.start_with?(dsym_filename)
          file_path = file_path.split('/')[1..-1].join('/')
        end

        dest_path = ::File.join(base_path, file_path)
        FileUtils.mkdir_p(::File.dirname(dest_path))
        entry.extract(dest_path) unless ::File.exist?(dest_path)
      end
    end
  }.call
end

#each_file(&block) ⇒ nil Also known as: each_objects

Returns:

  • (nil)


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

def each_file(&block)
  files.each { |file| block.call(file) }
end

#filesArray<DebugInfo> Also known as: objects

Returns dsym_files files by alphabetical order.

Returns:

  • (Array<DebugInfo>)

    dsym_files files by alphabetical order



22
23
24
25
26
# File 'lib/app_info/dsym.rb', line 22

def files
  @files ||= Dir.children(contents).sort.each_with_object([]) do |file, obj|
    obj << DebugInfo.new(::File.join(contents, file))
  end
end

#manufacturerSymbol

Returns Manufacturer.

Returns:



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

def manufacturer
  Manufacturer::APPLE
end