stf-client-neofreko 0.1.8 → 0.1.9
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/README.md +5 -0
- data/lib/stf/interactor/start_debug_session_interactor.rb +22 -7
- data/lib/stf/version.rb +1 -1
- data/lib/stf/view/cli.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cb65462de9b4a70126a7c2e1f7c15122449c092
|
|
4
|
+
data.tar.gz: 112abeeae010a47f14fb9cd229dc773c62ae0d87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01a417c8d0a1339b37f0cb9b07a8359bcad49431b2f4dfcb169bc25188712a6e9eeae8d82c1a94667f0a9f57708334b6711c8c1d40bd2a6b2223d27159384dbd
|
|
7
|
+
data.tar.gz: 5372d573833112a8d8679849606778679495bcf709cabeb6e11b74b8ab3082f2af9041e348355d59969f93e8eb6e095587e588dea13ee0a63e3d42b8ff1959ac
|
data/README.md
CHANGED
|
@@ -50,6 +50,11 @@ COMMANDS
|
|
|
50
50
|
ENVIRONMENT VARIABLES
|
|
51
51
|
STF_TOKEN - Authorization token
|
|
52
52
|
STF_URL - URL to STF
|
|
53
|
+
|
|
54
|
+
COMMAND OPTIONS
|
|
55
|
+
connect
|
|
56
|
+
-f - Filter devices in the form of "key:value". Use stf-client keys to list keys and stf-client values -k <key from prev command> to get list of applicable values
|
|
57
|
+
-d, --adb - Automatically execute adb connect command once device acquired. Default true
|
|
53
58
|
```
|
|
54
59
|
|
|
55
60
|
## Contributing
|
|
@@ -13,19 +13,19 @@ class StartDebugSessionInteractor
|
|
|
13
13
|
@stf = stf
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def execute(wanted, all_flag, filter)
|
|
16
|
+
def execute(wanted, all_flag, filter, auto_adb_connect)
|
|
17
17
|
wanted = 1 if wanted.nil?
|
|
18
18
|
wanted = wanted.to_i
|
|
19
19
|
|
|
20
20
|
1..10.times do
|
|
21
|
-
wanted -= connect(wanted, all_flag, filter)
|
|
21
|
+
wanted -= connect(wanted, all_flag, filter, auto_adb_connect)
|
|
22
22
|
return if all_flag || wanted <= 0
|
|
23
23
|
logger.info 'We are still waiting for ' + wanted.to_s + ' device(s). Retrying'
|
|
24
24
|
sleep 5
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def connect(wanted, all_flag, filter)
|
|
28
|
+
def connect(wanted, all_flag, filter, auto_adb_connect)
|
|
29
29
|
devices = @stf.get_devices
|
|
30
30
|
if devices.nil? || (devices.is_a?(Array) && devices.empty?)
|
|
31
31
|
logger.info 'No devices connected to STF'
|
|
@@ -58,14 +58,14 @@ class StartDebugSessionInteractor
|
|
|
58
58
|
|
|
59
59
|
n = 0
|
|
60
60
|
usable_devices.shuffle.each do |d|
|
|
61
|
-
n += 1 if connect_device(d)
|
|
61
|
+
n += 1 if connect_device(d, auto_adb_connect)
|
|
62
62
|
break if !all_flag && n >= wanted
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
n
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def connect_device(device)
|
|
68
|
+
def connect_device(device, auto_adb_connect)
|
|
69
69
|
return false if device.nil?
|
|
70
70
|
|
|
71
71
|
serial = device.serial
|
|
@@ -83,11 +83,26 @@ class StartDebugSessionInteractor
|
|
|
83
83
|
return false
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
logger.info "remoteConnectUrl: #{result.remoteConnectUrl}"
|
|
87
|
+
|
|
88
|
+
if auto_adb_connect
|
|
89
|
+
_execute_adb_with 30, "connect #{result.remoteConnectUrl}"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
result = @stf.start_debug serial
|
|
93
|
+
unless result.success
|
|
94
|
+
logger.error "Can't start debugging session for device #{serial}"
|
|
95
|
+
@stf.remove_device serial
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
return result.success
|
|
88
99
|
|
|
89
100
|
rescue Net::HTTPFatalError
|
|
90
101
|
logger.error 'Failed to start debug session'
|
|
91
102
|
return false
|
|
92
103
|
end
|
|
104
|
+
|
|
105
|
+
def _execute_adb_with(timeout, cmd)
|
|
106
|
+
execute_adb_with timeout, cmd
|
|
107
|
+
end
|
|
93
108
|
end
|
data/lib/stf/version.rb
CHANGED
data/lib/stf/view/cli.rb
CHANGED
|
@@ -42,13 +42,14 @@ module Stf
|
|
|
42
42
|
c.switch [:all]
|
|
43
43
|
c.flag [:n, :number]
|
|
44
44
|
c.flag [:f, :filter]
|
|
45
|
+
c.switch :adb, default_value: true, desc: 'automatically execute adb connect'
|
|
45
46
|
|
|
46
47
|
c.action do |_global_options, options, _args|
|
|
47
|
-
StartDebugSessionInteractor.new($stf).execute(options[:number], options[:all], options[:filter])
|
|
48
|
+
StartDebugSessionInteractor.new($stf).execute(options[:number], options[:all], options[:filter], options[:adb])
|
|
48
49
|
end
|
|
49
50
|
end
|
|
50
51
|
|
|
51
|
-
desc 'Show
|
|
52
|
+
desc 'Show available keys for filtering'
|
|
52
53
|
command :keys do |c|
|
|
53
54
|
c.action do |_global_options, _options, _args|
|
|
54
55
|
puts GetKeysInteractor.new($stf).execute
|