lib/ADB.rb in ADB-0.5.5 vs lib/ADB.rb in ADB-0.5.6
- old
+ new
@@ -9,11 +9,11 @@
# which is a part of the android toolset.
#
module ADB
include ADB::Instrumentation
- attr_reader :last_stdout, :last_stderr
+ attr_reader :last_stdout, :last_stderr
#
# start the server process
#
# @param timeout value for the command to complete. Defaults to 30
@@ -124,15 +124,28 @@
def shell(command, target={}, timeout=30)
execute_adb_with(timeout, "#{which_one(target)} wait-for-device shell #{command}")
end
#
+ # execute shell list packages command
+ #
+ # @param [String] optional switches, see adb shell list documentation
+ # @param [Hash] which device to wait for. Valid keys are :device,
+ # :emulator, and :serial.
+ # @param timeout value for the command to complete. Defaults to 30
+ # seconds.
+ #
+ def list_packages(switches='', target={}, timeout=30)
+ shell("pm list packages #{switches}", target, timeout)
+ end
+
+ #
# format a date for adb shell date command
#
# @param date to format. Defaults current date
#
- def format_date_for_adb(date=Date.new)
+ def format_date_for_adb(date=Date.new)
date.strftime("%C%y%m%d.%H%M00")
end
#
# setup port forwarding
@@ -205,10 +218,10 @@
private
def stdout_stderr_message
if not last_stdout.empty?
if not last_stderr.empty?
- return " Cause: #{last_stdout}, and Error: #{last_stderr}"
+ return " Cause: #{last_stdout}, and Error: #{last_stderr}"
else
return " Cause: #{last_stdout}"
end
elsif not last_stderr.empty?
return " Error: #{last_stderr}"