Class: Fastlane::Factory::AdbControllerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/automated_test_emulator_run/factory/adb_controller_factory.rb

Class Method Summary collapse

Class Method Details

.get_adb_controller(params) ⇒ Object



15
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
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fastlane/plugin/automated_test_emulator_run/factory/adb_controller_factory.rb', line 15

def self.get_adb_controller(params)
  UI.message(["Preparing commands for Android ADB"].join(" ").yellow)

  # Get paths
  sdk_helper = Helper::SdkHelper.new(params)
  path_avdmanager_binary = sdk_helper.avd_manager
  path_adb = sdk_helper.adb

  # ADB shell command parts
  sh_stop_adb = "kill-server"
  sh_start_adb = "start-server"
  sh_devices_adb = "devices"
  sh_wait_for_device_adb = "wait-for-device"
  sh_list_avd_adb = "list avd"

  # Assemble ADB controller
  adb_controller = ADB_Controller.new
  adb_controller.command_stop = [
   path_adb,
   sh_stop_adb
   ].join(" ")
  
  adb_controller.command_start = [
   path_adb,
   sh_start_adb
   ].join(" ")
  
  adb_controller.command_get_devices = [
   path_adb,
   sh_devices_adb
   ].join(" ")
  
  adb_controller.command_wait_for_device = [
   path_adb,
   sh_wait_for_device_adb
   ].join(" ")

  adb_controller.adb_path = path_adb

  adb_controller.command_get_avds = [
   path_avdmanager_binary, 
   sh_list_avd_adb].join(" ").chomp
  
  return adb_controller
end