Class: Maze::Option::Processor
- Inherits:
-
Object
- Object
- Maze::Option::Processor
- Defined in:
- lib/maze/option/processor.rb
Overview
Processes the parsed command line options
Class Method Summary collapse
-
.populate(config, options) ⇒ Object
Populates config from the parsed options given.
Class Method Details
.populate(config, options) ⇒ Object
Populates config from the parsed options given
13 14 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/maze/option/processor.rb', line 13 def populate(config, ) # Server options config.https = [Maze::Option::HTTPS] config.bind_address = [Maze::Option::BIND_ADDRESS] config.port = [Maze::Option::PORT] config.null_port = [Maze::Option::NULL_PORT] # General options config.aws_public_ip = [Maze::Option::AWS_PUBLIC_IP] config.enable_retries = [Maze::Option::RETRIES] config.enable_bugsnag = [Maze::Option::BUGSNAG] config.aspecto_repeater_api_key = [Maze::Option::ASPECTO_REPEATER_API_KEY] config.bugsnag_repeater_api_key = [Maze::Option::BUGSNAG_REPEATER_API_KEY] # Document server options config.document_server_root = [Maze::Option::DS_ROOT] config.document_server_bind_address = [Maze::Option::DS_BIND_ADDRESS] config.document_server_port = [Maze::Option::DS_PORT] # Logger options config.file_log = [Maze::Option::FILE_LOG] config.log_requests = [Maze::Option::LOG_REQUESTS] || !ENV['BUILDKITE'].nil? config.always_log = [Maze::Option::ALWAYS_LOG] # General appium options config.app = Maze::Helper.read_at_arg_file [Maze::Option::APP] farm = [Maze::Option::FARM] config.farm = case farm when nil then :none when 'bs' then :bs when 'bb' then :bb when 'local' then :local else raise "Unknown farm '#{farm}'" end config.locator = [Maze::Option::A11Y_LOCATOR] ? :accessibility_id : :id config.capabilities_option = [Maze::Option::CAPABILITIES] config.app_activity = [Maze::Option::APP_ACTIVITY] config.app_package = [Maze::Option::APP_PACKAGE] config.legacy_driver = !ENV['USE_LEGACY_DRIVER'].nil? config.start_tunnel = [Maze::Option::TUNNEL] # Farm specific options case config.farm when :bs device_option = [Maze::Option::DEVICE] if device_option.nil? || device_option.empty? config.browser = [Maze::Option::BROWSER] else if device_option.is_a?(Array) config.device = device_option.first config.device_list = device_option.drop(1) else config.device = device_option config.device_list = [] end if config.legacy_driver? config.os_version = Maze::Client::Appium::BrowserStackDevices::DEVICE_HASH[config.device]['os_version'].to_f else config.os_version = Maze::Client::Appium::BrowserStackDevices::DEVICE_HASH[config.device]['platformVersion'].to_f end end config.bs_local = Maze::Helper.([Maze::Option::BS_LOCAL]) config.appium_version = [Maze::Option::APPIUM_VERSION] username = config.username = [Maze::Option::USERNAME] access_key = config.access_key = [Maze::Option::ACCESS_KEY] config.appium_server_url = "http://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub" when :bb then config.username = [Maze::Option::USERNAME] config.access_key = [Maze::Option::ACCESS_KEY] config.appium_version = [Maze::Option::APPIUM_VERSION] device_option = [Maze::Option::DEVICE] if device_option.nil? || device_option.empty? # BitBar Web config.browser = [Maze::Option::BROWSER] config.browser_version = [Maze::Option::BROWSER_VERSION] else # BitBar Devices if device_option.is_a?(Array) config.device = device_option.first config.device_list = device_option.drop(1) else config.device = device_option config.device_list = [] end end config.os = [Maze::Option::OS] config.os_version = [Maze::Option::OS_VERSION] config.sb_local = Maze::Helper.([Maze::Option::SB_LOCAL]) config.appium_server_url = [Maze::Option::APPIUM_SERVER] config.selenium_server_url = [Maze::Option::SELENIUM_SERVER] config.app_bundle_id = [Maze::Option::APP_BUNDLE_ID] when :local then if [Maze::Option::BROWSER] config.browser = [Maze::Option::BROWSER] else os = config.os = [Maze::Option::OS].downcase config.os_version = [Maze::Option::OS_VERSION].to_f unless [Maze::Option::OS_VERSION].nil? config.appium_server_url = [Maze::Option::APPIUM_SERVER] config.start_appium = [Maze::Option::START_APPIUM] config.appium_logfile = [Maze::Option::APPIUM_LOGFILE] if os == 'ios' config.apple_team_id = [Maze::Option::APPLE_TEAM_ID] config.device_id = [Maze::Option::UDID] end end when :none if [Maze::Option::OS] config.os = [Maze::Option::OS].downcase end if [Maze::Option::OS_VERSION] config.os_version = [Maze::Option::OS_VERSION].to_f end else raise "Unexpected farm option #{config.farm}" end end |