android-adb-extension 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/android-adb-extension/adb.rb +32 -26
- data/lib/android-adb-extension/version.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c372e9595e796ee600ac792e4fb10be8b6e71f
|
4
|
+
data.tar.gz: c9f0e7241a0f70ef2c73cf15fcfdf153c1e6750a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be740cec548cac20ec8fb483f81668b1031511e0b4a739ece0b58dc4b5752602c19c87bfbaa307479bedaf41128c7dd7e3cd2cd34293d01b159f51cf63d6d9e7
|
7
|
+
data.tar.gz: c90288f44900801759c3c8d2ca076fc7856ba6e3de406f6c1e50b93d25d0922d5b0af8b261bad63bc6917e02052c57f87e328b4c667490962869807fd1ff1ccf
|
@@ -68,8 +68,8 @@ class ADB
|
|
68
68
|
change_airplane_mode(0)
|
69
69
|
end
|
70
70
|
|
71
|
-
def monkey(
|
72
|
-
`#{adb_shell_command} monkey -p #{
|
71
|
+
def monkey(package, event_count = 500)
|
72
|
+
`#{adb_shell_command} monkey -p #{package} #{event_count}`
|
73
73
|
end
|
74
74
|
|
75
75
|
def lock
|
@@ -89,38 +89,44 @@ class ADB
|
|
89
89
|
res.empty? ? nil : res
|
90
90
|
end
|
91
91
|
|
92
|
-
def bring_to_foreground(
|
93
|
-
res = `#{adb_shell_command} am start -n #{
|
92
|
+
def bring_to_foreground(package, activity)
|
93
|
+
res = `#{adb_shell_command} am start -n #{package}/#{activity}`
|
94
94
|
res.empty? ? nil : res
|
95
95
|
end
|
96
96
|
|
97
|
-
def reset_app(
|
98
|
-
res = `#{adb_shell_command} pm clear #{
|
97
|
+
def reset_app(package)
|
98
|
+
res = `#{adb_shell_command} pm clear #{package}`
|
99
99
|
res.empty? ? nil : res
|
100
100
|
end
|
101
101
|
|
102
|
-
def stop_app(
|
103
|
-
res = `#{adb_shell_command} am force-stop #{
|
102
|
+
def stop_app(package)
|
103
|
+
res = `#{adb_shell_command} am force-stop #{package}`
|
104
104
|
res.empty? ? nil : res
|
105
105
|
end
|
106
106
|
|
107
|
-
def uninstall_app(
|
108
|
-
res = `#{adb_shell_command} pm uninstall #{
|
107
|
+
def uninstall_app(package)
|
108
|
+
res = `#{adb_shell_command} pm uninstall #{package}`
|
109
109
|
res.empty? ? nil : res
|
110
110
|
end
|
111
111
|
|
112
|
-
def start_intent(
|
113
|
-
res = `#{adb_shell_command} am start -a android.intent.action.VIEW -d #{
|
112
|
+
def start_intent(uri)
|
113
|
+
res = `#{adb_shell_command} am start -a android.intent.action.VIEW -d #{uri}`
|
114
114
|
res.empty? ? nil : res
|
115
115
|
end
|
116
116
|
|
117
|
-
def input_text(
|
118
|
-
res = `#{adb_shell_command} input text #{
|
117
|
+
def input_text(text)
|
118
|
+
res = `#{adb_shell_command} input text #{text}`
|
119
119
|
res.empty? ? nil : res
|
120
120
|
end
|
121
121
|
|
122
|
-
def take_screenshot(
|
123
|
-
res = `#{adb_shell_command} screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > #{
|
122
|
+
def take_screenshot(file_name)
|
123
|
+
res = `#{adb_shell_command} screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > #{file_name}.png`
|
124
|
+
res.empty? ? nil : res
|
125
|
+
end
|
126
|
+
|
127
|
+
def swipe(x1, y1, x2, y2, duration = nil)
|
128
|
+
args = duration.nil? ? "#{x1} #{y1} #{x2} #{y2}" : "#{x1} #{y1} #{x2} #{y2} #{duration}"
|
129
|
+
res = `#{adb_shell_command} input swipe #{args}`
|
124
130
|
res.empty? ? nil : res
|
125
131
|
end
|
126
132
|
|
@@ -132,28 +138,28 @@ class ADB
|
|
132
138
|
|
133
139
|
private
|
134
140
|
|
135
|
-
def change_accelerometer_control(
|
136
|
-
adb_settings_system_command('accelerometer_rotation',
|
141
|
+
def change_accelerometer_control(mode)
|
142
|
+
adb_settings_system_command('accelerometer_rotation', mode)
|
137
143
|
end
|
138
144
|
|
139
|
-
def change_device_orientation(
|
140
|
-
adb_settings_system_command('user_rotation',
|
145
|
+
def change_device_orientation(orientation)
|
146
|
+
adb_settings_system_command('user_rotation', orientation)
|
141
147
|
end
|
142
148
|
|
143
|
-
def adb_settings_system_command(
|
149
|
+
def adb_settings_system_command(name, value)
|
144
150
|
command = "#{adb_shell_command} content insert"
|
145
151
|
param1 = '--uri content://settings/system'
|
146
|
-
param2 = "--bind name:s:#{
|
147
|
-
param3 = "--bind value:i:#{
|
152
|
+
param2 = "--bind name:s:#{name}"
|
153
|
+
param3 = "--bind value:i:#{value}"
|
148
154
|
|
149
155
|
`#{command} #{param1} #{param2} #{param3}`
|
150
156
|
end
|
151
157
|
|
152
|
-
def change_airplane_mode(
|
153
|
-
command1 = "#{adb_shell_command} settings put global airplane_mode_on #{
|
158
|
+
def change_airplane_mode(mode)
|
159
|
+
command1 = "#{adb_shell_command} settings put global airplane_mode_on #{mode}"
|
154
160
|
command2 = "#{adb_shell_command} am broadcast"
|
155
161
|
param1 = '-a android.intent.action.AIRPLANE_MODE'
|
156
|
-
param2 = "--ez state #{
|
162
|
+
param2 = "--ez state #{mode.to_boolean}"
|
157
163
|
|
158
164
|
`#{command1} & #{command2} #{param1} #{param2}`
|
159
165
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: android-adb-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jani Jegoroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: to_boolean
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-reporters
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.49'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.49'
|
83
83
|
description: Android Debug Bridge extension provides convenient metaclass to execute
|
84
84
|
ADB shell commands.
|
85
85
|
email:
|
@@ -111,9 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.4.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Android debug bridge extension.
|
118
118
|
test_files: []
|
119
|
-
has_rdoc:
|