android_workstation 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/amanage CHANGED
@@ -37,6 +37,30 @@ class AndroidLocalManage < Thor
37
37
  exec "adb -s #{d[0]} install -r #{Dir.glob("bin/*.apk").first}"
38
38
  end
39
39
  end
40
+
41
+ desc "uninstall", "uninstalling the app"
42
+ def uninstall
43
+ begin
44
+ manifest = Document.new(File.new(options[:manifest]))
45
+ rescue Exception=>e
46
+ puts "Could not find AndroidManifest.xml, execute from root of your project or use -m option to specify the location of the manifest"
47
+ exit(0)
48
+ end
49
+ package = package(manifest)
50
+ output = ""
51
+ IO.popen("adb devices") do |readme|
52
+ readme.each do |line|
53
+ output << line unless line.start_with? "List"
54
+ end
55
+ end
56
+ devices = output.scan(/(\w+)\tdevice\n+/)
57
+ puts "no device found"; exit(0) if devices.empty?
58
+ puts "no apk found in bin"; exit(0) if Dir.glob("bin/*.apk").empty?
59
+ devices.each do |d|
60
+ puts "uninstalling #{package} from device with serial #{d[0]}"
61
+ exec "adb -s #{d[0]} uninstall #{package}"
62
+ end
63
+ end
40
64
 
41
65
  desc "monkey", "Runs the monkey against the APK for this project placing the logs in the temp folder for the system"
42
66
  def monkey
@@ -57,7 +81,10 @@ class AndroidLocalManage < Thor
57
81
  devices = output.scan(/(\w+)\tdevice\n+/)
58
82
  devices.each do |d|
59
83
  puts "Running monkey #{Dir.glob("bin/*.apk").first} onto device with serial #{d[0]}"
60
- exec "adb -s #{d[0]} shell monkey -p #{package} -v #{1 * 60 * 1000} --throttle 2000 --ignore-crashes > #{Dir.tmpdir + "/" + d[0] + ".monkey"}"
84
+ bg = fork do
85
+ exec "adb -s #{d[0]} shell monkey -p #{package} -v #{1 * 60 * 1000} --throttle 2000 --ignore-crashes > #{Dir.tmpdir + "/" + d[0] + ".monkey"}"
86
+ end
87
+ Process.detach(bg)
61
88
  end
62
89
  end
63
90
 
@@ -1,3 +1,3 @@
1
1
  module AndroidWorkstation
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: android_workstation
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Carl-Gustaf Harroch