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 +28 -1
- data/lib/android_workstation/version.rb +1 -1
- metadata +1 -1
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
|
-
|
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
|
|