Class: AppInfo::InfoPlist
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(app_path) ⇒ InfoPlist
Returns a new instance of InfoPlist.
10
11
12
|
# File 'lib/app_info/ipa/info_plist.rb', line 10
def initialize(app_path)
@app_path = app_path
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
105
106
107
108
109
|
# File 'lib/app_info/ipa/info_plist.rb', line 105
def method_missing(method_name, *args, &block)
info.try(:[], Util.format_key(method_name)) ||
info.send(method_name) ||
super
end
|
Instance Method Details
101
102
103
|
# File 'lib/app_info/ipa/info_plist.rb', line 101
def [](key)
info.try(:[], key.to_s)
end
|
#build_version ⇒ Object
14
15
16
|
# File 'lib/app_info/ipa/info_plist.rb', line 14
def build_version
info.try(:[], 'CFBundleVersion')
end
|
#bundle_name ⇒ Object
35
36
37
|
# File 'lib/app_info/ipa/info_plist.rb', line 35
def bundle_name
info.try(:[], 'CFBundleName')
end
|
#device_type ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/app_info/ipa/info_plist.rb', line 67
def device_type
device_family = info.try(:[], 'UIDeviceFamily')
if device_family.length == 1
case device_family
when [1]
'iPhone'
when [2]
'iPad'
end
elsif device_family.length == 2 && device_family == [1, 2]
'Universal'
end
end
|
#display_name ⇒ Object
31
32
33
|
# File 'lib/app_info/ipa/info_plist.rb', line 31
def display_name
info.try(:[], 'CFBundleDisplayName')
end
|
#icons(uncrush = true) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/app_info/ipa/info_plist.rb', line 46
def icons(uncrush = true)
return @icons if @icons
@icons = []
icons_root_path.each do |name|
icon_array = info.try(:[], name)
.try(:[], 'CFBundlePrimaryIcon')
.try(:[], 'CFBundleIconFiles')
next if icon_array.nil? || icon_array.empty?
icon_array.each do |items|
Dir.glob(File.join(@app_path, "#{items}*")).find_all.each do |file|
@icons << icon_info(file, uncrush)
end
end
end
@icons
end
|
#identifier ⇒ Object
Also known as:
bundle_id
22
23
24
|
# File 'lib/app_info/ipa/info_plist.rb', line 22
def identifier
info.try(:[], 'CFBundleIdentifier')
end
|
#ipad? ⇒ Boolean
85
86
87
|
# File 'lib/app_info/ipa/info_plist.rb', line 85
def ipad?
device_type == 'iPad'
end
|
#iphone? ⇒ Boolean
81
82
83
|
# File 'lib/app_info/ipa/info_plist.rb', line 81
def iphone?
device_type == 'iPhone'
end
|
#min_sdk_version ⇒ Object
Extract the Minimum OS Version from the Info.plist
42
43
44
|
# File 'lib/app_info/ipa/info_plist.rb', line 42
def min_sdk_version
info.try(:[], 'MinimumOSVersion')
end
|
27
28
29
|
# File 'lib/app_info/ipa/info_plist.rb', line 27
def name
display_name || bundle_name
end
|
#release_type ⇒ Object
93
94
95
96
97
98
99
|
# File 'lib/app_info/ipa/info_plist.rb', line 93
def release_type
if stored?
'Store'
else
build_type
end
end
|
#release_version ⇒ Object
18
19
20
|
# File 'lib/app_info/ipa/info_plist.rb', line 18
def release_version
info.try(:[], 'CFBundleShortVersionString')
end
|
#respond_to_missing?(method_name, *args) ⇒ Boolean
111
112
113
114
115
|
# File 'lib/app_info/ipa/info_plist.rb', line 111
def respond_to_missing?(method_name, *args)
info.key?(Util.format_key(method_name)) ||
info.respond_to?(method_name) ||
super
end
|
#universal? ⇒ Boolean
89
90
91
|
# File 'lib/app_info/ipa/info_plist.rb', line 89
def universal?
device_type == 'Universal'
end
|