class AdbCommand

Public Instance Methods

command() click to toggle source
# File lib/replicant/commands/adb_command.rb, line 29
def command
  adb = "adb"
  adb << " -s #{@repl.default_device.id}" if @repl.default_device
  adb << " #{args}"
  adb << " #{@repl.default_package}" if @repl.default_package && package_dependent?
  adb << " 2>&1" # redirect stderr to stdout so that we can silence it
  adb
end
run() click to toggle source
# File lib/replicant/commands/adb_command.rb, line 11
def run
  Result.new.tap do |result|
    cmd = "#{command}"

    putsd cmd

    if interactive?
      system cmd
    else
      result.output = `#{cmd}`
      output result.output
    end
    result.pid  = $?.pid
    result.code = $?.exitstatus
    putsd "Command returned with exit status #{result.code}"
  end
end

Private Instance Methods

interactive?() click to toggle source
# File lib/replicant/commands/adb_command.rb, line 40
def interactive?
  args == "shell" || args.start_with?("logcat")
end
package_dependent?() click to toggle source
# File lib/replicant/commands/adb_command.rb, line 44
def package_dependent?
  ["uninstall"].include?(args)
end