Class: AppInfo::Proguard
Overview
Proguard parser
Constant Summary collapse
- NAMESPACE =
UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, 'icyleaf.com')
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #clear! ⇒ Object
- #contents ⇒ Object
- #file_type ⇒ Object
-
#initialize(file) ⇒ Proguard
constructor
A new instance of Proguard.
- #manifest ⇒ Object
- #manifest? ⇒ Boolean
- #manifest_path ⇒ Object
- #mapping? ⇒ Boolean
- #mapping_path ⇒ Object
- #package_name ⇒ Object
- #releasd_version ⇒ Object
- #symbol? ⇒ Boolean (also: #resource?)
- #symbol_path ⇒ Object (also: #resource_path)
- #uuid ⇒ Object (also: #debug_id)
- #version_code ⇒ Object (also: #build_version)
- #version_name ⇒ Object (also: #release_version)
Constructor Details
#initialize(file) ⇒ Proguard
Returns a new instance of Proguard.
14 15 16 |
# File 'lib/app_info/proguard.rb', line 14 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
12 13 14 |
# File 'lib/app_info/proguard.rb', line 12 def file @file end |
Instance Method Details
#clear! ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/app_info/proguard.rb', line 90 def clear! return unless @contents FileUtils.rm_rf(@contents) @contents = nil @manifest = nil @mapping_path = nil @metadata_path = nil @manifest_path = nil @symbol_path = nil end |
#contents ⇒ Object
86 87 88 |
# File 'lib/app_info/proguard.rb', line 86 def contents @contents ||= Util.unarchive(@file, path: 'proguard') end |
#file_type ⇒ Object
18 19 20 |
# File 'lib/app_info/proguard.rb', line 18 def file_type AppInfo::Platform::PROGUARD end |
#manifest ⇒ Object
67 68 69 70 71 |
# File 'lib/app_info/proguard.rb', line 67 def manifest return unless manifest? @manifest ||= REXML::Document.new(File.new(manifest_path)) end |
#manifest? ⇒ Boolean
32 33 34 |
# File 'lib/app_info/proguard.rb', line 32 def manifest? File.exist?(manifest_path) end |
#manifest_path ⇒ Object
77 78 79 |
# File 'lib/app_info/proguard.rb', line 77 def manifest_path @manifest_path ||= File.join(contents, 'AndroidManifest.xml') end |
#mapping? ⇒ Boolean
28 29 30 |
# File 'lib/app_info/proguard.rb', line 28 def mapping? File.exist?(mapping_path) end |
#mapping_path ⇒ Object
73 74 75 |
# File 'lib/app_info/proguard.rb', line 73 def mapping_path @mapping_path ||= Dir.glob(File.join(contents, '*mapping*.txt')).first end |
#package_name ⇒ Object
41 42 43 44 45 |
# File 'lib/app_info/proguard.rb', line 41 def package_name return unless manifest? manifest.root.attributes['package'] end |
#releasd_version ⇒ Object
47 48 49 50 51 |
# File 'lib/app_info/proguard.rb', line 47 def releasd_version return unless manifest? manifest.root.attributes['package'] end |
#symbol? ⇒ Boolean Also known as: resource?
36 37 38 |
# File 'lib/app_info/proguard.rb', line 36 def symbol? File.exist?(symbol_path) end |
#symbol_path ⇒ Object Also known as: resource_path
81 82 83 |
# File 'lib/app_info/proguard.rb', line 81 def symbol_path @symbol_path ||= File.join(contents, 'R.txt') end |
#uuid ⇒ Object Also known as: debug_id
22 23 24 25 |
# File 'lib/app_info/proguard.rb', line 22 def uuid # Similar to https://docs.sentry.io/workflow/debug-files/#proguard-uuids UUIDTools::UUID.sha1_create(NAMESPACE, File.read(mapping_path)).to_s end |
#version_code ⇒ Object Also known as: build_version
60 61 62 63 64 |
# File 'lib/app_info/proguard.rb', line 60 def version_code return unless manifest? manifest.root.attributes['versionCode'] end |
#version_name ⇒ Object Also known as: release_version
53 54 55 56 57 |
# File 'lib/app_info/proguard.rb', line 53 def version_name return unless manifest? manifest.root.attributes['versionName'] end |