class ClearCommand

Public Instance Methods

description() click to toggle source
# File lib/replicant/commands/clear_command.rb, line 3
def description
  "clear application data"
end
run() click to toggle source
# File lib/replicant/commands/clear_command.rb, line 16
def run
  package = args.present? ? args : @repl.default_package
  # Clear app data - cache, SharedPreferences, Databases
  AdbCommand.new(@repl, "shell su -c \"rm -r /data/data/#{package}/*\"").execute
  # Force application stop to recreate shared preferences, databases with new launch
  AdbCommand.new(@repl, "shell am force-stop #{package}").execute
end
usage() click to toggle source
# File lib/replicant/commands/clear_command.rb, line 12
def usage
  "#{name} [com.example.package|<empty>(when default package is set)]"
end
valid_args?() click to toggle source

TODO: this is not a very good argument validator

# File lib/replicant/commands/clear_command.rb, line 8
def valid_args?
  args.present? || @repl.default_package
end