Class: TestCenter::Helper::MultiScanManager::SimulatorHelper
- Inherits:
-
Object
- Object
- TestCenter::Helper::MultiScanManager::SimulatorHelper
- Defined in:
- lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb
Instance Method Summary collapse
- #clone_destination_simulators ⇒ Object
- #delete_multi_scan_cloned_simulators ⇒ Object
-
#initialize(options) ⇒ SimulatorHelper
constructor
A new instance of SimulatorHelper.
- #setup ⇒ Object
- #simulator_matches_destination(simulator, destination) ⇒ Object
Constructor Details
#initialize(options) ⇒ SimulatorHelper
Returns a new instance of SimulatorHelper.
5 6 7 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 5 def initialize() = end |
Instance Method Details
#clone_destination_simulators ⇒ Object
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/test_center/helper/multi_scan_manager/simulator_helper.rb', line 30 def clone_destination_simulators cloned_simulators = [] run_count = [:parallel_testrun_count] || 0 destinations = Scan.config[:destination].clone original_simulators = FastlaneCore::DeviceManager.simulators('iOS').find_all do |simulator| found_simulator = destinations.find do |destination| simulator_matches_destination(simulator, destination) end if found_simulator destinations.delete(found_simulator) end !found_simulator.nil? end original_simulators.each(&:shutdown) (0...run_count).each do |batch_index| cloned_simulators << [] original_simulators.each do |simulator| cloned_simulator = simulator.clone new_first_name = simulator.name.sub(/( ?\(.*| ?$)/, " Clone #{batch_index + 1}") FastlaneCore::UI.verbose("Cloned simulator #{simulator.name} to (name=#{new_first_name}, udid=#{cloned_simulator.udid}, OS=#{cloned_simulator.ios_version})") new_last_name = "#{self.class.name}<#{self.object_id}>" cloned_simulator.rename("#{new_first_name} #{new_last_name}") cloned_simulators.last << cloned_simulator end end cloned_simulators end |
#delete_multi_scan_cloned_simulators ⇒ Object
61 62 63 64 65 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 61 def delete_multi_scan_cloned_simulators FastlaneCore::DeviceManager.simulators('iOS').each do |simulator| simulator.delete if /#{self.class.name}<\d+>/ =~ simulator.name end end |
#setup ⇒ Object
9 10 11 12 13 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 9 def setup if [:parallel_testrun_count] > 1 && .fetch(:pre_delete_cloned_simulators, true) delete_multi_scan_cloned_simulators end end |
#simulator_matches_destination(simulator, destination) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 15 def simulator_matches_destination(simulator, destination) match = destination.match(/id=(?<udid>[^,]+)/) if match found_match = (match[:udid] == simulator.udid) else match = destination.match(/name=(?<name>[^,]+)/) name = match[:name] || '' match = destination.match(/OS=(?<os_version>[^,]+)/) os_version = match[:os_version] || '' found_match = (name == simulator.name && os_version == simulator.os_version) end found_match end |