android-adb-extension 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41d030a43a54c1a8949d2ac227a7de859756229b
4
- data.tar.gz: 5ed107c87cbf4510787ca855e34951901d125508
3
+ metadata.gz: 132e495adcd4e5ba874c6e033d7df8f65e7be31b
4
+ data.tar.gz: a868a9b814ac86e7d75416c037de78a8c6c2022b
5
5
  SHA512:
6
- metadata.gz: 2e8bf9aeeeb70314d703a41da178355cd943d3e41ffc788f5c4b1e8627e5804cd0f617467f6021e0224f0c759b8005119ffec24b3a1db12d14bb73e9b95453e2
7
- data.tar.gz: 1e3370f903f6e9248e66c16ee81d6cb60c0e3f17a1aa188ce086c3b2b9fe0d2dba560d9e6ce7891a2499b127aa8c7903045006c2e74d715e16f740cb1eb74948
6
+ metadata.gz: a151a6cdb29ce70b339c9acba22dc7a46a029f549a932c322df3a720d0f6296bb956f09c7b7164215e19e50ccf674a248e70b9a8b9c729ba0492b1bc52e4da16
7
+ data.tar.gz: 10af7aea987d2db31f3f0ca241fabfde6602a9dc4210fa5ad9855b5ac0695536281907edcf833cf6e0a6f4e5f732723498e33ad827ebc8f178c232a8ecc685e2
@@ -3,11 +3,11 @@
3
3
  class ADB
4
4
  class << self
5
5
  def sdk
6
- `adb shell getprop ro.build.version.sdk`.strip.to_i
6
+ `#{adb_shell_command} getprop ro.build.version.sdk`.strip.to_i
7
7
  end
8
8
 
9
9
  def release
10
- `adb shell getprop ro.build.version.release`.strip
10
+ `#{adb_shell_command} getprop ro.build.version.release`.strip
11
11
  end
12
12
 
13
13
  def major
@@ -15,7 +15,7 @@ class ADB
15
15
  end
16
16
 
17
17
  def orientation
18
- `adb shell dumpsys input |
18
+ `#{adb_shell_command} dumpsys input |
19
19
  grep 'SurfaceOrientation' |
20
20
  awk '{ print $2 }'`.strip.to_i
21
21
  end
@@ -43,7 +43,7 @@ class ADB
43
43
  end
44
44
 
45
45
  def airplane_mode
46
- `adb shell settings get global airplane_mode_on`.strip.to_i
46
+ `#{adb_shell_command} settings get global airplane_mode_on`.strip.to_i
47
47
  end
48
48
 
49
49
  def airplane_mode?
@@ -59,28 +59,28 @@ class ADB
59
59
  end
60
60
 
61
61
  def monkey(aPackageName, aEventCount = 500)
62
- `adb shell monkey -p #{aPackageName} #{aEventCount}`
62
+ `#{adb_shell_command} monkey -p #{aPackageName} #{aEventCount}`
63
63
  end
64
64
 
65
65
  def lock
66
- cmd = 'adb shell input keyevent 26'
66
+ cmd = "#{adb_shell_command} input keyevent 26"
67
67
  `#{cmd}`
68
68
  res = `#{cmd}`
69
69
  res.empty? ? nil : res
70
70
  end
71
71
 
72
72
  def unlock
73
- res = `adb shell input keyevent 82`
73
+ res = `#{adb_shell_command} input keyevent 82`
74
74
  res.empty? ? nil : res
75
75
  end
76
76
 
77
77
  def send_to_background
78
- res = `adb shell input keyevent 3`
78
+ res = `#{adb_shell_command} input keyevent 3`
79
79
  res.empty? ? nil : res
80
80
  end
81
81
 
82
82
  def bring_to_foreground(aPackage, aActivity)
83
- res = `adb shell am start -n #{aPackage}/#{aActivity}`
83
+ res = `#{adb_shell_command} am start -n #{aPackage}/#{aActivity}`
84
84
  res.empty? ? nil : res
85
85
  end
86
86
 
@@ -93,7 +93,7 @@ class ADB
93
93
  private
94
94
 
95
95
  def change_accelerometer_control(aMode)
96
- command = 'adb shell content insert'
96
+ command = "#{adb_shell_command} content insert"
97
97
  param1 = '--uri content://settings/system'
98
98
  param2 = '--bind name:s:accelerometer_rotation'
99
99
  param3 = "--bind value:i:#{aMode}"
@@ -102,7 +102,7 @@ class ADB
102
102
  end
103
103
 
104
104
  def change_device_orientation(aOrientation)
105
- command = 'adb shell content insert'
105
+ command = "#{adb_shell_command} content insert"
106
106
  param1 = '--uri content://settings/system'
107
107
  param2 = '--bind name:s:user_rotation'
108
108
  param3 = "--bind value:i:#{aOrientation}"
@@ -111,12 +111,28 @@ class ADB
111
111
  end
112
112
 
113
113
  def change_airplane_mode(aMode)
114
- command1 = "adb shell settings put global airplane_mode_on #{aMode}"
115
- command2 = 'adb shell am broadcast'
114
+ command1 = "#{adb_shell_command} settings put global airplane_mode_on #{aMode}"
115
+ command2 = "#{adb_shell_command} am broadcast"
116
116
  param1 = '-a android.intent.action.AIRPLANE_MODE'
117
117
  param2 = "--ez state #{aMode.to_boolean}"
118
118
 
119
119
  `#{command1} & #{command2} #{param1} #{param2}`
120
120
  end
121
+
122
+ def multiple_devices?
123
+ !adb_device_arg.nil?
124
+ end
125
+
126
+ def device_id
127
+ adb_device_arg
128
+ end
129
+
130
+ def adb_device_arg
131
+ ENV['ADB_DEVICE_ARG']
132
+ end
133
+
134
+ def adb_shell_command
135
+ multiple_devices? ? "adb -s #{device_id} shell" : 'adb shell'
136
+ end
121
137
  end
122
138
  end
@@ -1,5 +1,5 @@
1
1
  # Gem version
2
2
  #
3
3
  module AndroidAdbExtension
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jani Jegoroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: to_boolean
@@ -116,4 +116,3 @@ signing_key:
116
116
  specification_version: 4
117
117
  summary: Android debug bridge extension.
118
118
  test_files: []
119
- has_rdoc: