Class: Rubtools::Tools::Android
Instance Attribute Summary collapse
-
#adb ⇒ Object
Returns the value of attribute adb.
Attributes inherited from Recipe
Instance Method Summary collapse
-
#devices ⇒ Object
Puts the list of available devices.
-
#initialize ⇒ Android
constructor
Initialize the Android recipe.
-
#remove(package) ⇒ Object
Remove packages.
-
#uninstall(packages) ⇒ Object
Uninstall packages.
Methods inherited from Recipe
Constructor Details
#initialize ⇒ Android
Initialize the Android recipe
8 9 10 |
# File 'lib/tools/android.rb', line 8 def initialize @adb = "adb" end |
Instance Attribute Details
#adb ⇒ Object
Returns the value of attribute adb.
4 5 6 |
# File 'lib/tools/android.rb', line 4 def adb @adb end |
Instance Method Details
#devices ⇒ Object
Puts the list of available devices
14 15 16 |
# File 'lib/tools/android.rb', line 14 def devices puts get_devices() end |
#remove(package) ⇒ Object
Remove packages
20 21 22 |
# File 'lib/tools/android.rb', line 20 def remove(package) uninstall(package) end |
#uninstall(packages) ⇒ Object
Uninstall packages
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/tools/android.rb', line 26 def uninstall(packages) devices = get_devices() if devices.any? if devices.size > 1 Logger.info "There is more than one device:" devices.each_with_index {|device, index| puts "#{index}: #{device}"} print "Choose one: " answer = STDIN.gets.chomp begin device = devices[Integer(answer)] rescue ArgumentError => e Logger.error "Error: Not a valid option (" + e. + ")" end else device = devices.first end if device while packages.size > 0 do exec(@adb + " -s " + device + " uninstall " + packages.pop) end end else Logger.error "No found devices..." end end |