Class: AppInfo::Parser::IPA

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

Overview

IPA parser

Defined Under Namespace

Modules: ExportType

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ IPA

Returns a new instance of IPA.



22
23
24
25
# File 'lib/app_info/parser/ipa.rb', line 22

def initialize(file)
  @file = file
  @app_path = app_path
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



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

def app_path
  @app_path
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

Instance Method Details

#build_typeObject



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/app_info/parser/ipa.rb', line 114

def build_type
  return ExportType::UNKOWN unless AppInfo::Parser.mac?

  if mobileprovision?
    if devices
      ExportType::ADHOC
    else
      ExportType::INHOUSE
    end
  else
    ExportType::DEBUG
  end
end

#build_versionObject



43
44
45
# File 'lib/app_info/parser/ipa.rb', line 43

def build_version
  info.build_version
end

#bundle_nameObject



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

def bundle_name
  info.bundle_name
end

#cleanup!Object



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/app_info/parser/ipa.rb', line 180

def cleanup!
  return unless @contents
  FileUtils.rm_rf(@contents)

  @contents = nil
  @icons = nil
  @app_path = nil
   = nil
   = nil
  @info = nil
end

#device_typeObject



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

def device_type
  info.device_type
end

#devicesObject



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

def devices
  mobileprovision.devices
end

#display_nameObject



59
60
61
# File 'lib/app_info/parser/ipa.rb', line 59

def display_name
  info.display_name
end

#distribution_nameObject



102
103
104
# File 'lib/app_info/parser/ipa.rb', line 102

def distribution_name
  "#{profile_name} - #{team_name}" if profile_name && team_name
end

#expired_dateObject



98
99
100
# File 'lib/app_info/parser/ipa.rb', line 98

def expired_date
  mobileprovision.expired_date
end

#hide_developer_certificatesObject



132
133
134
# File 'lib/app_info/parser/ipa.rb', line 132

def hide_developer_certificates
  mobileprovision.delete('DeveloperCertificates') if mobileprovision?
end

#iconsObject



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

def icons
  info.icons
end

#identifierObject Also known as: bundle_id



51
52
53
# File 'lib/app_info/parser/ipa.rb', line 51

def identifier
  info.identifier
end

#infoObject



172
173
174
# File 'lib/app_info/parser/ipa.rb', line 172

def info
  @info ||= InfoPlist.new(@app_path)
end

#ipad?Boolean

Returns:

  • (Boolean)


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

def ipad?
  info.ipad?
end

#iphone?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/app_info/parser/ipa.rb', line 31

def iphone?
  info.iphone?
end

#metadataObject



159
160
161
162
# File 'lib/app_info/parser/ipa.rb', line 159

def 
  return unless metadata?
   ||= CFPropertyList.native_types(CFPropertyList::List.new(file: ).value)
end

#metadata?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'lib/app_info/parser/ipa.rb', line 164

def metadata?
  File.exist?()
end

#metadata_pathObject



168
169
170
# File 'lib/app_info/parser/ipa.rb', line 168

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

#min_sdk_versionObject

Return the minimum OS version for the given application



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

def min_sdk_version
  info.min_sdk_version
end

#mobileprovisionObject



136
137
138
139
140
141
142
143
# File 'lib/app_info/parser/ipa.rb', line 136

def mobileprovision
  return unless mobileprovision?
  return @mobileprovision if @mobileprovision

  file = AppInfo::Parser.mac? ? mobileprovision_path : nil

  @mobileprovision = MobileProvision.new(file)
end

#mobileprovision?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/app_info/parser/ipa.rb', line 145

def mobileprovision?
  File.exist?mobileprovision_path
end

#mobileprovision_pathObject



149
150
151
152
153
154
155
156
157
# File 'lib/app_info/parser/ipa.rb', line 149

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

#nameObject



55
56
57
# File 'lib/app_info/parser/ipa.rb', line 55

def name
  display_name || bundle_name
end

#osObject



27
28
29
# File 'lib/app_info/parser/ipa.rb', line 27

def os
  Parser::Platform::IOS
end

#profile_nameObject



94
95
96
# File 'lib/app_info/parser/ipa.rb', line 94

def profile_name
  mobileprovision.profile_name
end

#release_typeObject



106
107
108
109
110
111
112
# File 'lib/app_info/parser/ipa.rb', line 106

def release_type
  if stored?
    ExportType::RELEASE
  else
    build_type
  end
end

#release_versionObject



47
48
49
# File 'lib/app_info/parser/ipa.rb', line 47

def release_version
  info.release_version
end

#stored?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/app_info/parser/ipa.rb', line 128

def stored?
  metadata? ? true : false
end

#team_identifierObject



90
91
92
# File 'lib/app_info/parser/ipa.rb', line 90

def team_identifier
  mobileprovision.team_identifier
end

#team_nameObject



86
87
88
# File 'lib/app_info/parser/ipa.rb', line 86

def team_name
  mobileprovision.team_name
end

#universal?Boolean

Returns:

  • (Boolean)


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

def universal?
  info.universal?
end