Class: AppInfo::Macos
Overview
Defined Under Namespace
Modules: ExportType
Constant Summary
Helper::HumanFileSize::FILE_SIZE_UNITS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#tempdir, #unarchive
#file_to_human_size, #number_to_human_size
Constructor Details
#initialize(file) ⇒ Macos
Returns a new instance of Macos.
24
25
26
|
# File 'lib/app_info/macos.rb', line 24
def initialize(file)
@file = file
end
|
Instance Attribute Details
Returns the value of attribute file.
15
16
17
|
# File 'lib/app_info/macos.rb', line 15
def file
@file
end
|
Instance Method Details
129
130
131
|
# File 'lib/app_info/macos.rb', line 129
def app_path
@app_path ||= Dir.glob(File.join(contents, '*.app')).first
end
|
#archs ⇒ Object
Also known as:
architectures
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/app_info/macos.rb', line 74
def archs
return unless File.exist?(binary_path)
file = MachO.open(binary_path)
case file
when MachO::MachOFile
[file.cpusubtype]
else
file.machos.each_with_object([]) do |arch, obj|
obj << arch.cpusubtype
end
end
end
|
#binary_path ⇒ Object
111
112
113
114
115
116
117
118
119
|
# File 'lib/app_info/macos.rb', line 111
def binary_path
return @binary_path if @binary_path
base_path = File.join(app_path, 'Contents', 'MacOS')
binary = info['CFBundleExecutable']
return File.join(base_path, binary) if binary
@binary_path ||= Dir.glob(File.join(base_path, '*')).first
end
|
133
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/app_info/macos.rb', line 133
def clear!
return unless @contents
FileUtils.rm_rf(@contents)
@contents = nil
@app_path = nil
@binrary_path = nil
@info_path = nil
@info = nil
@icons = nil
end
|
146
147
148
|
# File 'lib/app_info/macos.rb', line 146
def contents
@contents ||= unarchive(@file, path: 'macos')
end
|
#distribution_name ⇒ Object
44
45
46
|
# File 'lib/app_info/macos.rb', line 44
def distribution_name
"#{profile_name} - #{team_name}" if profile_name && team_name
end
|
#hide_developer_certificates ⇒ Object
89
90
91
|
# File 'lib/app_info/macos.rb', line 89
def hide_developer_certificates
mobileprovision.delete('DeveloperCertificates') if mobileprovision?
end
|
#icons(convert: true) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/app_info/macos.rb', line 62
def icons(convert: true)
return unless icon_file
data = {
name: File.basename(icon_file),
file: icon_file
}
convert_icns_to_png(data) if convert
data
end
|
121
122
123
|
# File 'lib/app_info/macos.rb', line 121
def info
@info ||= InfoPlist.new(info_path)
end
|
#info_path ⇒ Object
125
126
127
|
# File 'lib/app_info/macos.rb', line 125
def info_path
@info_path ||= File.join(app_path, 'Contents', 'Info.plist')
end
|
#mobileprovision ⇒ Object
93
94
95
96
97
|
# File 'lib/app_info/macos.rb', line 93
def mobileprovision
return unless mobileprovision?
@mobileprovision ||= MobileProvision.new(mobileprovision_path)
end
|
#mobileprovision? ⇒ Boolean
99
100
101
|
# File 'lib/app_info/macos.rb', line 99
def mobileprovision?
File.exist?(mobileprovision_path)
end
|
#mobileprovision_path ⇒ Object
103
104
105
|
# File 'lib/app_info/macos.rb', line 103
def mobileprovision_path
@mobileprovision_path ||= File.join(app_path, 'Contents', 'embedded.provisionprofile')
end
|
#os ⇒ Object
Also known as:
file_type
32
33
34
|
# File 'lib/app_info/macos.rb', line 32
def os
Platform::MACOS
end
|
#size(human_size: false) ⇒ Object
28
29
30
|
# File 'lib/app_info/macos.rb', line 28
def size(human_size: false)
file_to_human_size(@file, human_size: human_size)
end
|
#store_path ⇒ Object
107
108
109
|
# File 'lib/app_info/macos.rb', line 107
def store_path
@store_path ||= File.join(app_path, 'Contents', '_MASReceipt', 'receipt')
end
|
#stored? ⇒ Boolean
58
59
60
|
# File 'lib/app_info/macos.rb', line 58
def stored?
File.exist?(store_path)
end
|