Class: LogcatCommand

Inherits:
Command show all
Defined in:
lib/replicant/command.rb

Instance Attribute Summary

Attributes inherited from Command

#args

Instance Method Summary collapse

Methods inherited from Command

all, #execute, inherited, #initialize, load, #name, #usage

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#descriptionObject



290
291
292
# File 'lib/replicant/command.rb', line 290

def description
  "access device logs"
end

#runObject



298
299
300
301
302
303
304
305
306
307
308
# File 'lib/replicant/command.rb', line 298

def run
  pid = if @repl.default_package
    processes = AdbCommand.new(@repl, "shell ps", :silent => true).execute
    pid_line = processes.lines.detect {|l| l.include?(@repl.default_package)}
    pid_line.split[1].strip if pid_line
  end

  logcat = "logcat -v time"
  logcat << " | grep -E '\(\s*#{pid}\)'"
  AdbCommand.new(@repl, logcat).execute
end

#valid_args?Boolean



294
295
296
# File 'lib/replicant/command.rb', line 294

def valid_args?
  args.blank?
end