Module: TryScanManager::Helper::FastlaneScanHelper

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

Class Method Summary collapse

Class Method Details



12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 12

def self.print_scan_parameters(params)
  return if FastlaneCore::Helper.test?

  FastlaneCore::PrintTable.print_values(
    config: params,
    title: "Summary for scan #{Fastlane::VERSION}"
  )
end

.remove_preexisting_simulator_logs(params) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 25

def self.remove_preexisting_simulator_logs(params)
  return unless params[:include_simulator_logs]

  output_directory = report_options.instance_variable_get(:@output_directory)
  glob_pattern = "#{output_directory}/**/system_logs-*.{log,logarchive}"
  logs = Dir.glob(glob_pattern)
  FileUtils.rm_rf(logs)
end

.remove_preexisting_test_result_bundles(params) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 34

def self.remove_preexisting_test_result_bundles(params)
  output_directory = report_options.instance_variable_get(:@output_directory)
  glob_pattern = "#{output_directory}/**/*.test_result"
  preexisting_test_result_bundles = Dir.glob(glob_pattern)
  if preexisting_test_result_bundles.size > 0
    FastlaneCore::UI.verbose("Removing pre-existing test_result bundles: ")
    preexisting_test_result_bundles.each { |bundle| FastlaneCore::UI.verbose("  #{bundle}") }
    FileUtils.rm_rf(preexisting_test_result_bundles)
  end
end

.remove_preexisting_xcresult_bundles(params) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 45

def self.remove_preexisting_xcresult_bundles(params)
  output_directory = report_options.instance_variable_get(:@output_directory)
  glob_pattern = "#{output_directory}/**/*.xcresult"
  preexisting_xcresult_bundles = Dir.glob(glob_pattern)
  if preexisting_xcresult_bundles.size > 0
    FastlaneCore::UI.verbose("Removing pre-existing xcresult bundles: ")
    preexisting_xcresult_bundles.each { |bundle| FastlaneCore::UI.verbose("  #{bundle}") }
    FileUtils.rm_rf(preexisting_xcresult_bundles)
  end
end

.remove_report_filesObject



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 56

def self.remove_report_files
  output_files = report_options.instance_variable_get(:@output_files)
  output_directory = report_options.instance_variable_get(:@output_directory)

  unless output_files.empty?
    FastlaneCore::UI.verbose("Removing report files")
    output_files.each do |output_file|
      report_file = File.join(output_directory, output_file)
      FastlaneCore::UI.verbose("  #{report_file}")
      FileUtils.rm_f(report_file)
    end
  end
end

.report_optionsObject



4
5
6
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 4

def self.report_options
  Scan::XCPrettyReporterOptionsGenerator.generate_from_scan_config
end

.scan_options_from_try_scan_options(params) ⇒ Object



21
22
23
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 21

def self.scan_options_from_try_scan_options(params)
  params.select { |key, _| valid_scan_keys.include?(key) }
end

.valid_scan_keysObject



8
9
10
# File 'lib/fastlane/plugin/try_scan/helper/scan_helper.rb', line 8

def self.valid_scan_keys
  Fastlane::Actions::ScanAction.available_options.map(&:key)
end