Module: TestCenter::Helper::ScanHelper

Defined in:
lib/fastlane/plugin/test_center/helper/scan_helper.rb

Class Method Summary collapse

Class Method Details

.options_from_configuration_file(params) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fastlane/plugin/test_center/helper/scan_helper.rb', line 32

def self.options_from_configuration_file(params)
  config = FastlaneCore::Configuration.create(
    Fastlane::Actions::ScanAction.available_options,
    params
  )
  config_file = config.load_configuration_file(Scan.scanfile_name, nil, true)
    
  overridden_options = config_file ? config_file.options : {}
    
  FastlaneCore::Project.detect_projects(config)
  project = FastlaneCore::Project.new(config)
  
  imported_path = File.expand_path(Scan.scanfile_name)
  Dir.chdir(File.expand_path("..", project.path)) do
    config_file = config.load_configuration_file(Scan.scanfile_name, nil, true) unless File.expand_path(Scan.scanfile_name) == imported_path
    overridden_options.merge!(config_file.options) if config_file
  end
  overridden_options
end


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/plugin/test_center/helper/scan_helper.rb', line 5

def self.print_scan_parameters(params)
  return if FastlaneCore::Helper.test?
    
  # :nocov:
  FastlaneCore::PrintTable.print_values(
    config: params,
    hide_keys: [:destination, :slack_url],
    title: "Summary for scan #{Fastlane::VERSION}"
  )
  # :nocov:
end

.remove_preexisting_simulator_logs(params) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/test_center/helper/scan_helper.rb', line 17

def self.remove_preexisting_simulator_logs(params)
  return unless params[:include_simulator_logs]
    
  output_directory = File.absolute_path(params.fetch(:output_directory, 'test_results'))
    
  glob_pattern = "#{output_directory}/**/system_logs-*.{log,logarchive}"
  logs = Dir.glob(glob_pattern)
  FileUtils.rm_rf(logs)
end

.scan_options_from_multi_scan_options(params) ⇒ Object



27
28
29
30
# File 'lib/fastlane/plugin/test_center/helper/scan_helper.rb', line 27

def self.scan_options_from_multi_scan_options(params)
  valid_scan_keys = Fastlane::Actions::ScanAction.available_options.map(&:key)
  params.select { |k,v| valid_scan_keys.include?(k) }
end