Class: FIR::Parser::Ipa::App
- Includes:
- Common
- Defined in:
- lib/fir/util/parser/ipa.rb
Instance Method Summary collapse
- #basic_info ⇒ Object
- #devices ⇒ Object
- #display_name ⇒ Object
- #distribution_name ⇒ Object
- #full_info(options) ⇒ Object
- #has_mobileprovision? ⇒ Boolean
- #hide_developer_certificates ⇒ Object
- #icons ⇒ Object
- #identifier ⇒ Object
- #info ⇒ Object
-
#initialize(path) ⇒ App
constructor
A new instance of App.
- #mobileprovision ⇒ Object
- #mobileprovision_path ⇒ Object
- #name ⇒ Object
- #release_type ⇒ Object
- #short_version ⇒ Object
- #tmp_icons ⇒ Object
- #version ⇒ Object
Methods included from Common
Constructor Details
#initialize(path) ⇒ App
Returns a new instance of App.
63 64 65 |
# File 'lib/fir/util/parser/ipa.rb', line 63 def initialize(path) @path = path end |
Instance Method Details
#basic_info ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fir/util/parser/ipa.rb', line 75 def basic_info @basic_info ||= { type: 'ios', identifier: identifier, name: name, display_name: display_name, build: version.to_s, version: short_version.to_s, devices: devices, release_type: release_type, distribution_name: distribution_name } end |
#devices ⇒ Object
155 156 157 |
# File 'lib/fir/util/parser/ipa.rb', line 155 def devices mobileprovision['ProvisionedDevices'] if has_mobileprovision? end |
#display_name ⇒ Object
102 103 104 |
# File 'lib/fir/util/parser/ipa.rb', line 102 def display_name info['CFBundleDisplayName'] end |
#distribution_name ⇒ Object
159 160 161 |
# File 'lib/fir/util/parser/ipa.rb', line 159 def distribution_name "#{mobileprovision['Name']} - #{mobileprovision['TeamName']}" if has_mobileprovision? end |
#full_info(options) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/fir/util/parser/ipa.rb', line 67 def full_info() if .fetch(:full_info, false) basic_info.merge!(icons: tmp_icons) end basic_info end |
#has_mobileprovision? ⇒ Boolean
143 144 145 |
# File 'lib/fir/util/parser/ipa.rb', line 143 def has_mobileprovision? File.file? mobileprovision_path end |
#hide_developer_certificates ⇒ Object
151 152 153 |
# File 'lib/fir/util/parser/ipa.rb', line 151 def hide_developer_certificates mobileprovision.delete('DeveloperCertificates') if has_mobileprovision? end |
#icons ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/fir/util/parser/ipa.rb', line 118 def icons @icons ||= begin icons = [] info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].each do |name| icons << get_image(name) icons << get_image("#{name}@2x") end icons.delete_if &:! rescue NoMethodError [] end end |
#identifier ⇒ Object
98 99 100 |
# File 'lib/fir/util/parser/ipa.rb', line 98 def identifier info['CFBundleIdentifier'] end |
#info ⇒ Object
89 90 91 92 |
# File 'lib/fir/util/parser/ipa.rb', line 89 def info @info ||= CFPropertyList.native_types( CFPropertyList::List.new(file: File.join(@path, 'Info.plist')).value) end |
#mobileprovision ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/fir/util/parser/ipa.rb', line 131 def mobileprovision return unless has_mobileprovision? return @mobileprovision if @mobileprovision cmd = "security cms -D -i \"#{mobileprovision_path}\"" begin @mobileprovision = CFPropertyList.native_types(CFPropertyList::List.new(data: `#{cmd}`).value) rescue CFFormatError @mobileprovision = {} end end |
#mobileprovision_path ⇒ Object
147 148 149 |
# File 'lib/fir/util/parser/ipa.rb', line 147 def mobileprovision_path @mobileprovision_path ||= File.join(@path, 'embedded.mobileprovision') end |
#name ⇒ Object
94 95 96 |
# File 'lib/fir/util/parser/ipa.rb', line 94 def name info['CFBundleName'] end |
#release_type ⇒ Object
163 164 165 166 167 168 169 170 171 |
# File 'lib/fir/util/parser/ipa.rb', line 163 def release_type if has_mobileprovision? if devices 'adhoc' else 'inhouse' end end end |
#short_version ⇒ Object
110 111 112 |
# File 'lib/fir/util/parser/ipa.rb', line 110 def short_version info['CFBundleShortVersionString'] end |
#tmp_icons ⇒ Object
114 115 116 |
# File 'lib/fir/util/parser/ipa.rb', line 114 def tmp_icons icons.map { |data| generate_tmp_icon(data) } end |
#version ⇒ Object
106 107 108 |
# File 'lib/fir/util/parser/ipa.rb', line 106 def version info['CFBundleVersion'] end |