Class: AppInfo::IPA

Inherits:
Apple show all
Defined in:
lib/app_info/ipa.rb

Constant Summary

Constants included from Helper::HumanFileSize

Helper::HumanFileSize::FILE_SIZE_UNITS

Instance Attribute Summary

Attributes inherited from File

#file, #logger

Instance Method Summary collapse

Methods inherited from Apple

#archs, #build_type, #build_version, #bundle_id, #bundle_name, #contents, #device, #devices, #display_name, #distribution_name, #expired_date, #hide_developer_certificates, #identifier, #info, #ipad?, #iphone?, #manufacturer, #min_os_version, #min_sdk_version, #mobileprovision, #mobileprovision?, #name, #platform, #profile_name, #release_type, #release_version, #size, #team_identifier, #team_name, #universal?

Methods included from Helper::Archive

#tempdir, #unarchive

Methods included from Helper::HumanFileSize

#file_to_human_size, #number_to_human_size

Methods inherited from File

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

Constructor Details

This class inherits a constructor from AppInfo::File

Instance Method Details

#app_pathString

Returns:

  • (String)


88
89
90
# File 'lib/app_info/ipa.rb', line 88

def app_path
  @app_path ||= Dir.glob(::File.join(contents, 'Payload', '*.app')).first
end

#binary_pathString

Returns:

  • (String)


78
79
80
# File 'lib/app_info/ipa.rb', line 78

def binary_path
  @binary_path ||= ::File.join(app_path, info.bundle_name)
end

#clear!Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/app_info/ipa.rb', line 111

def clear!
  return unless @contents

  FileUtils.rm_rf(@contents)

  @contents = nil
  @app_path = nil
  @info_path = nil
  @info = nil
  @metadata_path = nil
  @metadata = nil
  @icons_path = nil
  @icons = nil
end

#frameworksArray<Framework>

Returns:



45
46
47
# File 'lib/app_info/ipa.rb', line 45

def frameworks
  @frameworks ||= Framework.parse(app_path)
end

#icons(uncrush: true) ⇒ Array<Hash{Symbol => String, Array<Integer>}>

Full icons metadata

Examples:

aab.icons
# => [
#   {
#     name: 'icon.png',
#     file: '/path/to/icon.png',
#     uncrushed_file: '/path/to/uncrushed_icon.png',
#     dimensions: [64, 64]
#   },
#   {
#     name: 'icon1.png',
#     file: '/path/to/icon1.png',
#     uncrushed_file: '/path/to/uncrushed_icon1.png',
#     dimensions: [120, 120]
#   }
# ]

Returns:

  • (Array<Hash{Symbol => String, Array<Integer>}>)

    icons paths of icons



28
29
30
31
32
# File 'lib/app_info/ipa.rb', line 28

def icons(uncrush: true)
  @icons ||= icons_path.each_with_object([]) do |file, obj|
    obj << (file, uncrush: uncrush)
  end
end

#icons_pathArray<String>

Returns:

  • (Array<String>)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/app_info/ipa.rb', line 93

def icons_path
  @icons_path ||= lambda {
    icon_keys.each_with_object([]) do |name, icons|
      filenames = info.try(:[], name)
                      .try(:[], 'CFBundlePrimaryIcon')
                      .try(:[], 'CFBundleIconFiles')

      next if filenames.nil? || filenames.empty?

      filenames.each do |filename|
        Dir.glob(::File.join(app_path, "#{filename}*")).find_all.each do |file|
          icons << file
        end
      end
    end
  }.call
end

#info_pathString

Returns:

  • (String)


83
84
85
# File 'lib/app_info/ipa.rb', line 83

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

#metadataCFPropertyList

Returns:

  • (CFPropertyList)


61
62
63
64
65
# File 'lib/app_info/ipa.rb', line 61

def 
  return unless metadata?

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

#metadata?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/app_info/ipa.rb', line 68

def metadata?
  ::File.exist?()
end

#metadata_pathString

Returns:

  • (String)


73
74
75
# File 'lib/app_info/ipa.rb', line 73

def 
  @metadata_path ||= ::File.join(contents, 'iTunesMetadata.plist')
end

#mobileprovision_pathString

Returns:

  • (String)


50
51
52
53
54
55
56
57
58
# File 'lib/app_info/ipa.rb', line 50

def mobileprovision_path
  filename = 'embedded.mobileprovision'
  @mobileprovision_path ||= ::File.join(@file, filename)
  unless ::File.exist?(@mobileprovision_path)
    @mobileprovision_path = ::File.join(app_path, filename)
  end

  @mobileprovision_path
end

#pluginsArray<Plugin>

Returns:



40
41
42
# File 'lib/app_info/ipa.rb', line 40

def plugins
  @plugins ||= Plugin.parse(app_path)
end

#stored?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/app_info/ipa.rb', line 35

def stored?
  !!metadata?
end