Class: DeviceAPI::Android::AAPT
- Inherits:
-
Execution
- Object
- Execution
- DeviceAPI::Android::AAPT
- Defined in:
- lib/device_api/android/aapt.rb
Overview
Namespace for all methods encapsulating aapt calls
Class Method Summary collapse
-
.aapt_available? ⇒ Boolean
Check to ensure that aapt has been setup correctly and is available.
-
.get_app_props(apk) ⇒ Hash
Gets properties from the apk and returns them in a hash.
Class Method Details
.aapt_available? ⇒ Boolean
Check to ensure that aapt has been setup correctly and is available
15 16 17 18 |
# File 'lib/device_api/android/aapt.rb', line 15 def self.aapt_available? result = execute('which aapt') result.exit == 0 end |
.get_app_props(apk) ⇒ Hash
Gets properties from the apk and returns them in a hash
23 24 25 26 27 28 29 30 |
# File 'lib/device_api/android/aapt.rb', line 23 def self.get_app_props(apk) raise StandardError.new('aapt not found - please create a symlink in $ANDROID_HOME/tools') unless aapt_available? result = execute("aapt dump badging #{apk}") fail result.stderr if result.exit != 0 result.stdout.scan(/(.*): (.*)/).map { |a,b| { a => Hash[b.split(' ').map { |c| c.tr('\'','').split('=') }] } } end |