Class: ClearCommand
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
- #description ⇒ Object
- #run ⇒ Object
- #usage ⇒ Object
-
#valid_args? ⇒ Boolean
TODO: this is not a very good argument validator.
Methods inherited from Command
all, #execute, inherited, #initialize, load, #name
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#description ⇒ Object
313 314 315 |
# File 'lib/replicant/command.rb', line 313 def description "clear application data" end |
#run ⇒ Object
326 327 328 329 330 331 332 |
# File 'lib/replicant/command.rb', line 326 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 ⇒ Object
322 323 324 |
# File 'lib/replicant/command.rb', line 322 def usage "#{name} [com.example.package|<empty>(when default package is set)]" end |
#valid_args? ⇒ Boolean
TODO: this is not a very good argument validator
318 319 320 |
# File 'lib/replicant/command.rb', line 318 def valid_args? args.present? || @repl.default_package end |