Class: StopDebugSessionInteractor
- Inherits:
-
Object
- Object
- StopDebugSessionInteractor
- Includes:
- ADB, Log
- Defined in:
- lib/stf/interactor/stop_debug_session_interactor.rb
Instance Method Summary collapse
- #execute(remoteConnectUrl) ⇒ Object
-
#initialize(stf) ⇒ StopDebugSessionInteractor
constructor
A new instance of StopDebugSessionInteractor.
Methods included from Log
Constructor Details
#initialize(stf) ⇒ StopDebugSessionInteractor
Returns a new instance of StopDebugSessionInteractor.
12 13 14 |
# File 'lib/stf/interactor/stop_debug_session_interactor.rb', line 12 def initialize(stf) @stf = stf end |
Instance Method Details
#execute(remoteConnectUrl) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/stf/interactor/stop_debug_session_interactor.rb', line 16 def execute(remoteConnectUrl) remote_devices = @stf.get_user_devices device = remote_devices.find { |d| d.remoteConnect == true && d.remoteConnectUrl.eql?(remoteConnectUrl) } raise DeviceNotAvailableError if device.nil? execute_adb_with 30, "disconnect #{device.remoteConnectUrl}" success = false 1..10.times do success = @stf.stop_debug(device.serial) if success == true break elsif logger.error 'Can\'t stop debug session. Retrying' end end 1..10.times do success = @stf.remove_device(device.serial) if success == true break elsif logger.error 'Can\'t remove device from user devices. Retrying' end end if success == true logger.info "Successfully removed #{remoteConnectUrl}" elsif logger.error "Error removing #{remoteConnectUrl}" end return success end |