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.
13 14 15 |
# File 'lib/app_info/proguard.rb', line 13 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
11 12 13 |
# File 'lib/app_info/proguard.rb', line 11 def file @file end |
Instance Method Details
#clear! ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/app_info/proguard.rb', line 89 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
85 86 87 |
# File 'lib/app_info/proguard.rb', line 85 def contents @contents ||= Util.unarchive(@file, path: 'proguard') end |
#file_type ⇒ Object
17 18 19 |
# File 'lib/app_info/proguard.rb', line 17 def file_type AppInfo::Platform::PROGUARD end |
#manifest ⇒ Object
66 67 68 69 70 |
# File 'lib/app_info/proguard.rb', line 66 def manifest return unless manifest? @manifest ||= REXML::Document.new(File.new(manifest_path)) end |
#manifest? ⇒ Boolean
31 32 33 |
# File 'lib/app_info/proguard.rb', line 31 def manifest? File.exist?(manifest_path) end |
#manifest_path ⇒ Object
76 77 78 |
# File 'lib/app_info/proguard.rb', line 76 def manifest_path @manifest_path ||= File.join(contents, 'AndroidManifest.xml') end |
#mapping? ⇒ Boolean
27 28 29 |
# File 'lib/app_info/proguard.rb', line 27 def mapping? File.exist?(mapping_path) end |
#mapping_path ⇒ Object
72 73 74 |
# File 'lib/app_info/proguard.rb', line 72 def mapping_path @mapping_path ||= Dir.glob(File.join(contents, '*mapping*.txt')).first end |
#package_name ⇒ Object
40 41 42 43 44 |
# File 'lib/app_info/proguard.rb', line 40 def package_name return unless manifest? manifest.root.attributes['package'] end |
#releasd_version ⇒ Object
46 47 48 49 50 |
# File 'lib/app_info/proguard.rb', line 46 def releasd_version return unless manifest? manifest.root.attributes['package'] end |
#symbol? ⇒ Boolean Also known as: resource?
35 36 37 |
# File 'lib/app_info/proguard.rb', line 35 def symbol? File.exist?(symbol_path) end |
#symbol_path ⇒ Object Also known as: resource_path
80 81 82 |
# File 'lib/app_info/proguard.rb', line 80 def symbol_path @symbol_path ||= File.join(contents, 'R.txt') end |
#uuid ⇒ Object Also known as: debug_id
21 22 23 24 |
# File 'lib/app_info/proguard.rb', line 21 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
59 60 61 62 63 |
# File 'lib/app_info/proguard.rb', line 59 def version_code return unless manifest? manifest.root.attributes['versionCode'] end |
#version_name ⇒ Object Also known as: release_version
52 53 54 55 56 |
# File 'lib/app_info/proguard.rb', line 52 def version_name return unless manifest? manifest.root.attributes['versionName'] end |