Class: AppInfo::PackInfo

Inherits:
File
  • Object
show all
Defined in:
lib/app_info/pack_info.rb

Overview

HarmonyOS pack.info parser

Instance Attribute Summary

Attributes inherited from File

#file, #logger

Instance Method Summary collapse

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

#appJSON

Returns:

  • (JSON)


27
28
29
# File 'lib/app_info/pack_info.rb', line 27

def app
  @app ||= summary['app']
end

#bundle_nameString Also known as: bundle_id

Returns:

  • (String)


21
22
23
# File 'lib/app_info/pack_info.rb', line 21

def bundle_name
  app['bundleName']
end

#contentJSON

Returns:

  • (JSON)


47
48
49
# File 'lib/app_info/pack_info.rb', line 47

def content
  JSON.parse(::File.read(@file))
end

#modulesArray<JSON>

Returns:

  • (Array<JSON>)


32
33
34
# File 'lib/app_info/pack_info.rb', line 32

def modules
  @modules ||= summary['modules']
end

#packagesArray<JSON>

Returns:

  • (Array<JSON>)


42
43
44
# File 'lib/app_info/pack_info.rb', line 42

def packages
  @packages ||= content['packages']
end

#summaryJSON

Returns:

  • (JSON)


37
38
39
# File 'lib/app_info/pack_info.rb', line 37

def summary
  @summary ||= content['summary']
end

#version_codeString Also known as: build_version

Returns:

  • (String)


9
10
11
# File 'lib/app_info/pack_info.rb', line 9

def version_code
  app['version']['code']
end

#version_nameString Also known as: release_version

Returns:

  • (String)


15
16
17
# File 'lib/app_info/pack_info.rb', line 15

def version_name
  app['version']['name']
end