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, is_stored = false) ⇒ 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, is_stored = false) ⇒ App
Returns a new instance of App.
63 64 65 66 |
# File 'lib/fir/util/parser/ipa.rb', line 63 def initialize(path, is_stored = false) @path = path @is_stored = is_stored end |
Instance Method Details
#basic_info ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fir/util/parser/ipa.rb', line 76 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
156 157 158 |
# File 'lib/fir/util/parser/ipa.rb', line 156 def devices mobileprovision['ProvisionedDevices'] if has_mobileprovision? end |
#display_name ⇒ Object
103 104 105 |
# File 'lib/fir/util/parser/ipa.rb', line 103 def display_name info['CFBundleDisplayName'] end |
#distribution_name ⇒ Object
160 161 162 |
# File 'lib/fir/util/parser/ipa.rb', line 160 def distribution_name "#{mobileprovision['Name']} - #{mobileprovision['TeamName']}" if has_mobileprovision? end |
#full_info(options) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/fir/util/parser/ipa.rb', line 68 def full_info() if .fetch(:full_info, false) basic_info.merge!(icons: tmp_icons) end basic_info end |
#has_mobileprovision? ⇒ Boolean
144 145 146 |
# File 'lib/fir/util/parser/ipa.rb', line 144 def has_mobileprovision? File.file? mobileprovision_path end |
#hide_developer_certificates ⇒ Object
152 153 154 |
# File 'lib/fir/util/parser/ipa.rb', line 152 def hide_developer_certificates mobileprovision.delete('DeveloperCertificates') if has_mobileprovision? end |
#icons ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/fir/util/parser/ipa.rb', line 119 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
99 100 101 |
# File 'lib/fir/util/parser/ipa.rb', line 99 def identifier info['CFBundleIdentifier'] end |
#info ⇒ Object
90 91 92 93 |
# File 'lib/fir/util/parser/ipa.rb', line 90 def info @info ||= CFPropertyList.native_types( CFPropertyList::List.new(file: File.join(@path, 'Info.plist')).value) end |
#mobileprovision ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/fir/util/parser/ipa.rb', line 132 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
148 149 150 |
# File 'lib/fir/util/parser/ipa.rb', line 148 def mobileprovision_path @mobileprovision_path ||= File.join(@path, 'embedded.mobileprovision') end |
#name ⇒ Object
95 96 97 |
# File 'lib/fir/util/parser/ipa.rb', line 95 def name info['CFBundleName'] end |
#release_type ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/fir/util/parser/ipa.rb', line 164 def release_type if @is_stored 'store' else if has_mobileprovision? if devices 'adhoc' else 'inhouse' end end end end |
#short_version ⇒ Object
111 112 113 |
# File 'lib/fir/util/parser/ipa.rb', line 111 def short_version info['CFBundleShortVersionString'] end |
#tmp_icons ⇒ Object
115 116 117 |
# File 'lib/fir/util/parser/ipa.rb', line 115 def tmp_icons icons.map { |data| generate_tmp_icon(data, :ipa) } end |
#version ⇒ Object
107 108 109 |
# File 'lib/fir/util/parser/ipa.rb', line 107 def version info['CFBundleVersion'] end |