Class: AppInfo::Proguard
Overview
Constant Summary
collapse
- NAMESPACE =
UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, 'icyleaf.com')
Instance Attribute Summary
Attributes inherited from File
#file, #logger
Instance Method Summary
collapse
#tempdir, #unarchive
Methods inherited from File
#device, #format, #initialize, #not_implemented_error!, #size
Constructor Details
This class inherits a constructor from AppInfo::File
Instance Method Details
#clear! ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/app_info/proguard.rb', line 108
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 ⇒ String
Returns contents path of contents.
104
105
106
|
# File 'lib/app_info/proguard.rb', line 104
def contents
@contents ||= unarchive(@file, prefix: 'proguard')
end
|
#files ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/app_info/proguard.rb', line 69
def files
Dir.children(contents).each_with_object([]) do |filename, obj|
path = ::File.join(contents, filename)
obj << {
name: filename,
path: path,
size: ::File.size(path)
}
end
end
|
#manifest ⇒ REXML::Document
81
82
83
84
85
|
# File 'lib/app_info/proguard.rb', line 81
def manifest
return unless manifest?
@manifest ||= REXML::Document.new(::File.new(manifest_path))
end
|
#manifest? ⇒ Boolean
36
37
38
|
# File 'lib/app_info/proguard.rb', line 36
def manifest?
::File.exist?(manifest_path)
end
|
#manifest_path ⇒ String
93
94
95
|
# File 'lib/app_info/proguard.rb', line 93
def manifest_path
@manifest_path ||= ::File.join(contents, 'AndroidManifest.xml')
end
|
#manufacturer ⇒ Symbol
14
15
16
|
# File 'lib/app_info/proguard.rb', line 14
def manufacturer
Manufacturer::GOOGLE
end
|
#mapping? ⇒ Boolean
31
32
33
|
# File 'lib/app_info/proguard.rb', line 31
def mapping?
::File.exist?(mapping_path)
end
|
#mapping_path ⇒ String
88
89
90
|
# File 'lib/app_info/proguard.rb', line 88
def mapping_path
@mapping_path ||= Dir.glob(::File.join(contents, '*mapping*.txt')).first
end
|
#package_name ⇒ String?
47
48
49
50
51
|
# File 'lib/app_info/proguard.rb', line 47
def package_name
return unless manifest?
manifest.root.attributes['package']
end
|
19
20
21
|
# File 'lib/app_info/proguard.rb', line 19
def platform
Platform::ANDROID
end
|
#symbol? ⇒ Boolean
Also known as:
resource?
41
42
43
|
# File 'lib/app_info/proguard.rb', line 41
def symbol?
::File.exist?(symbol_path)
end
|
#symbol_path ⇒ String
Also known as:
resource_path
98
99
100
|
# File 'lib/app_info/proguard.rb', line 98
def symbol_path
@symbol_path ||= ::File.join(contents, 'R.txt')
end
|
#uuid ⇒ String
Also known as:
debug_id
24
25
26
27
|
# File 'lib/app_info/proguard.rb', line 24
def uuid
UUIDTools::UUID.sha1_create(NAMESPACE, ::File.read(mapping_path)).to_s
end
|
#version_code ⇒ String?
Also known as:
build_version
62
63
64
65
66
|
# File 'lib/app_info/proguard.rb', line 62
def version_code
return unless manifest?
manifest.root.attributes['versionCode']
end
|
#version_name ⇒ String?
Also known as:
release_version
54
55
56
57
58
|
# File 'lib/app_info/proguard.rb', line 54
def version_name
return unless manifest?
manifest.root.attributes['versionName']
end
|