Class: Rubtools::Tools::Android
Instance Attribute Summary
Attributes inherited from Recipe
#available_methods, #config, #methods_hidden, #options
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
are_methods_hidden?, available_methods, #error, #exec, #exec_without_output, hide_methods, #info, new, #os, register_methods, #success, #symlink, #verbose, #which
Constructor Details
#initialize ⇒ Android
Initialize the Android recipe
8 9 10 |
# File 'lib/tools/android.rb', line 8 def initialize @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 verbose 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 verbose "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 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 error "No found devices..." end end |