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
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() @options = end |
Instance Method Details
#clone_destination_simulators ⇒ 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 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 15 def clone_destination_simulators cloned_simulators = [] run_count = @options[:parallel_testrun_count] || 0 destination_simulator_ids = Scan.config[:destination].map do |destination| destination.split(',id=').last end original_simulators = FastlaneCore::DeviceManager.simulators('iOS').find_all do |simulator| destination_simulator_ids.include?(simulator.udid) end original_simulators.each(&:shutdown) (0...run_count).each do |batch_index| cloned_simulators << [] original_simulators.each do |simulator| FastlaneCore::UI.verbose("Cloning simulator") cloned_simulator = simulator.clone new_first_name = simulator.name.sub(/( ?\(.*| ?$)/, " Clone #{batch_index + 1}") 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
41 42 43 44 45 |
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb', line 41 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 @options[:parallel_testrun_count] > 1 && @options.fetch(:pre_delete_cloned_simulators, true) delete_multi_scan_cloned_simulators end end |