Class: AppInfo::HAP
Overview
Parse HAP file parser
Constant Summary
Constants included from AppInfo::Helper::HumanFileSize
AppInfo::Helper::HumanFileSize::FILE_SIZE_UNITS
Instance Attribute Summary
Attributes inherited from File
Instance Method Summary collapse
- #clear! ⇒ Object
-
#icons ⇒ Array<Hash{Symbol => String, Array<Integer>}>
Full icons metadata.
- #icons_path ⇒ Array<String>
- #module_info ⇒ JSON
- #module_info_path ⇒ String
- #name ⇒ String
Methods inherited from HarmonyOS
#contents, #device, #info_path, #manufacturer, #pack_info, #platform, #size
Methods included from AppInfo::Helper::Archive
Methods included from AppInfo::Helper::HumanFileSize
#file_to_human_size, #number_to_human_size
Methods inherited from File
#device, #format, #initialize, #manufacturer, #not_implemented_error!, #platform, #size
Constructor Details
This class inherits a constructor from AppInfo::File
Instance Method Details
#clear! ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/app_info/hap.rb', line 58 def clear! return unless @contents FileUtils.rm_rf(@contents) @pack_info = nil @info_path = nil @contents = nil @module_info_path = nil @module_info = nil @icons_path = nil @icons = nil end |
#icons ⇒ Array<Hash{Symbol => String, Array<Integer>}>
Full icons metadata
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/app_info/hap.rb', line 24 def icons @icons ||= icons_path.each_with_object([]) do |file, obj| obj << { name: ::File.basename(file), file: file, uncrushed_file: file, dimensions: ImageSize.path(file).size } end end |
#icons_path ⇒ Array<String>
36 37 38 |
# File 'lib/app_info/hap.rb', line 36 def icons_path @icons_path ||= [::File.join(contents, 'resources', 'base', 'media', 'app_icon.png')] end |
#module_info ⇒ JSON
41 42 43 |
# File 'lib/app_info/hap.rb', line 41 def module_info @module_info ||= JSON.parse(::File.read(module_info_path)) end |
#module_info_path ⇒ String
46 47 48 |
# File 'lib/app_info/hap.rb', line 46 def module_info_path @module_info_path ||= ::File.join(contents, 'module.json') end |
#name ⇒ String
51 52 53 54 55 56 |
# File 'lib/app_info/hap.rb', line 51 def name # TODO: The application display name should be determined by looking up # the value of the variable named in the "label" field of the "module.json" # file within the "resources.index" file. pack_info.bundle_name end |