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



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/app_info/parser/ipa.rb', line 107

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



173
174
175
176
177
178
179
180
181
182
183
# File 'lib/app_info/parser/ipa.rb', line 173

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

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

#device_typeObject



71
72
73
# File 'lib/app_info/parser/ipa.rb', line 71

def device_type
  info.device_type
end

#devicesObject



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

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



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

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

#expired_dateObject



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

def expired_date
  mobileprovision.expired_date
end

#hide_developer_certificatesObject



125
126
127
# File 'lib/app_info/parser/ipa.rb', line 125

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



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

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



152
153
154
155
# File 'lib/app_info/parser/ipa.rb', line 152

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

#metadata?Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/app_info/parser/ipa.rb', line 157

def metadata?
  File.exist?()
end

#metadata_pathObject



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

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

#mobileprovisionObject



129
130
131
132
133
134
135
136
# File 'lib/app_info/parser/ipa.rb', line 129

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)


138
139
140
# File 'lib/app_info/parser/ipa.rb', line 138

def mobileprovision?
  File.exist?mobileprovision_path
end

#mobileprovision_pathObject



142
143
144
145
146
147
148
149
150
# File 'lib/app_info/parser/ipa.rb', line 142

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



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

def profile_name
  mobileprovision.profile_name
end

#release_typeObject



99
100
101
102
103
104
105
# File 'lib/app_info/parser/ipa.rb', line 99

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)


121
122
123
# File 'lib/app_info/parser/ipa.rb', line 121

def stored?
  metadata? ? true : false
end

#team_identifierObject



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

def team_identifier
  mobileprovision.team_identifier
end

#team_nameObject



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

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