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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7a39aecb1413197418e86e9bc8dc862d892f50b
4
- data.tar.gz: e9121b20e6b63003fb678b7f90fef403c1fb7b10
3
+ metadata.gz: 21c372e9595e796ee600ac792e4fb10be8b6e71f
4
+ data.tar.gz: c9f0e7241a0f70ef2c73cf15fcfdf153c1e6750a
5
5
  SHA512:
6
- metadata.gz: 5266d8e8a7e0dab33ab72f03848213e7a7f2b6f9336ded81798918c17fa7c7b4b3081693c2908dd039a395e3cf677d3dde94b15698c351851ade48246a1aa11a
7
- data.tar.gz: 322f5bcf02191be5333b01e18ad2b6b1905f6dcdf046e6ec6f68d74c3f923b5fa7f78aa4395170954672440bc0a80dae1b7261e97ce6a8153c538e79b5f4a52c
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(aPackageName, aEventCount = 500)
72
- `#{adb_shell_command} monkey -p #{aPackageName} #{aEventCount}`
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(aPackage, aActivity)
93
- res = `#{adb_shell_command} am start -n #{aPackage}/#{aActivity}`
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(aPackage)
98
- res = `#{adb_shell_command} pm clear #{aPackage}`
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(aPackage)
103
- res = `#{adb_shell_command} am force-stop #{aPackage}`
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(aPackage)
108
- res = `#{adb_shell_command} pm uninstall #{aPackage}`
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(aUri)
113
- res = `#{adb_shell_command} am start -a android.intent.action.VIEW -d #{aUri}`
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(aText)
118
- res = `#{adb_shell_command} input text #{aText}`
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(aFileName)
123
- res = `#{adb_shell_command} screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > #{aFileName}.png`
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(aMode)
136
- adb_settings_system_command('accelerometer_rotation', aMode)
141
+ def change_accelerometer_control(mode)
142
+ adb_settings_system_command('accelerometer_rotation', mode)
137
143
  end
138
144
 
139
- def change_device_orientation(aOrientation)
140
- adb_settings_system_command('user_rotation', aOrientation)
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(aName, aValue)
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:#{aName}"
147
- param3 = "--bind value:i:#{aValue}"
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(aMode)
153
- command1 = "#{adb_shell_command} settings put global airplane_mode_on #{aMode}"
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 #{aMode.to_boolean}"
162
+ param2 = "--ez state #{mode.to_boolean}"
157
163
 
158
164
  `#{command1} & #{command2} #{param1} #{param2}`
159
165
  end
@@ -1,5 +1,5 @@
1
1
  # Gem version
2
2
  #
3
3
  module AndroidAdbExtension
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'.freeze
5
5
  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.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: 2016-07-18 00:00:00.000000000 Z
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: '11.2'
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: '11.2'
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.9'
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.9'
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.41'
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.41'
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.2.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: