android_workstation 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/android_workstation.gemspec +8 -1
- data/bin/amanage +24 -0
- data/bin/asql +1 -30
- data/lib/android_workstation/version.rb +1 -1
- metadata +2 -2
data/android_workstation.gemspec
CHANGED
@@ -10,7 +10,14 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["carl@novoda.com"]
|
11
11
|
s.homepage = "https://github.com/charroch/android_workstation"
|
12
12
|
s.summary = %q{Utility tools to help with android development}
|
13
|
-
s.description = %q{
|
13
|
+
s.description = %q{
|
14
|
+
Android utilities to be executed within the android root project following a standard structure (apk in bin folder etc...)
|
15
|
+
|
16
|
+
From the root of your project where the AndroidManifest.xml is located, you can use the following
|
17
|
+
|
18
|
+
asql => android sql utility
|
19
|
+
amanage => managing APK/monkey etc...
|
20
|
+
}
|
14
21
|
|
15
22
|
s.rubyforge_project = "android_workstation"
|
16
23
|
|
data/bin/amanage
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rexml/document'
|
5
5
|
require 'thor'
|
6
|
+
require 'tmpdir'
|
6
7
|
|
7
8
|
include REXML
|
8
9
|
|
@@ -37,6 +38,29 @@ class AndroidLocalManage < Thor
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
desc "monkey", "Runs the monkey against the APK for this project placing the logs in the temp folder for the system"
|
42
|
+
def monkey
|
43
|
+
invoke :install
|
44
|
+
begin
|
45
|
+
manifest = Document.new(File.new(options[:manifest]))
|
46
|
+
rescue Exception=>e
|
47
|
+
puts "Could not find AndroidManifest.xml, execute from root of your project or use -m option to specify the location of the manifest"
|
48
|
+
exit(0)
|
49
|
+
end
|
50
|
+
package = package(manifest)
|
51
|
+
output = ""
|
52
|
+
IO.popen("adb devices") do |readme|
|
53
|
+
readme.each do |line|
|
54
|
+
output << line unless line.start_with? "List"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
devices = output.scan(/(\w+)\tdevice\n+/)
|
58
|
+
devices.each do |d|
|
59
|
+
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"}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
40
64
|
private
|
41
65
|
def package(manifest)
|
42
66
|
XPath.each(manifest, "//manifest@package").first.attribute("package").value
|
data/bin/asql
CHANGED
@@ -53,36 +53,7 @@ class AndroidLocalSQLite < Thor
|
|
53
53
|
fields ||= "*"
|
54
54
|
exec "adb shell sqlite3 /data/data/#{package}/databases/#{dbname} 'select #{fields} from #{options[:table_name]} #{where};'"
|
55
55
|
end
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "pull [FILE]", "pull from the current directory's project the file specified"
|
59
|
-
def pull(file)
|
60
|
-
begin
|
61
|
-
manifest = Document.new(File.new(options[:manifest]))
|
62
|
-
rescue Exception=>e
|
63
|
-
puts "Could not find AndroidManifest.xml, execute from root of your project or use -m option to specify the location of the manifest"
|
64
|
-
exit(0)
|
65
|
-
end
|
66
|
-
package = package(manifest)
|
67
|
-
exec "adb pull /data/data/#{package}/files/#{file} ."
|
68
|
-
end
|
69
|
-
|
70
|
-
desc "install", "installing the APK located in bin against all devices connected"
|
71
|
-
def install
|
72
|
-
output = ""
|
73
|
-
IO.popen("adb devices") do |readme|
|
74
|
-
readme.each do |line|
|
75
|
-
output << line unless line.start_with? "List"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
devices = output.scan(/(\w+)\tdevice\n+/)
|
79
|
-
puts "no device found"; exit(0) if devices.empty?
|
80
|
-
puts "no apk found in bin"; exit(0) if Dir.glob("bin/*.apk").empty?
|
81
|
-
devices.each do |d|
|
82
|
-
puts "installing #{Dir.glob("bin/*.apk").first} onto device with serial #{d[0]}"
|
83
|
-
exec "adb -s #{d[0]} install -r #{Dir.glob("bin/*.apk").first}"
|
84
|
-
end
|
85
|
-
end
|
56
|
+
end
|
86
57
|
|
87
58
|
private
|
88
59
|
def package(manifest)
|
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.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Carl-Gustaf Harroch
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version: "0"
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
|
-
description: Android utilities to be executed within the android root project following a standard structure (apk in bin folder etc...)
|
27
|
+
description: "\n Android utilities to be executed within the android root project following a standard structure (apk in bin folder etc...)\n \n From the root of your project where the AndroidManifest.xml is located, you can use the following\n \n asql => android sql utility\n amanage => managing APK/monkey etc...\n "
|
28
28
|
email:
|
29
29
|
- carl@novoda.com
|
30
30
|
executables:
|