Class: Scan::ReportCollector
- Inherits:
-
Object
- Object
- Scan::ReportCollector
- Defined in:
- lib/scan/report_collector.rb
Constant Summary collapse
- SUPPORTED =
%w(html junit json-compilation-database)
Instance Method Summary collapse
-
#generate_commands(path, types: nil, output_file_name: nil) ⇒ Object
Returns a hash containg the resulting path as key and the command as value.
- #parse_raw_file(path) ⇒ Object
Instance Method Details
#generate_commands(path, types: nil, output_file_name: nil) ⇒ Object
Returns a hash containg the resulting path as key and the command as value
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 |
# File 'lib/scan/report_collector.rb', line 21 def generate_commands(path, types: nil, output_file_name: nil) types ||= Scan.config[:output_types] types = types.split(",") if types.kind_of?(String) # might already be an array when passed via fastlane commands = {} types.each do |raw| type = raw.strip unless SUPPORTED.include?(type) Helper.log.error "Couldn't find reporter '#{type}', available #{SUPPORTED.join(', ')}" next end file_name = "report.#{type}" output_path = output_file_name || File.join(File.(Scan.config[:output_directory]), file_name) parts = ["cat '#{path}' | "] parts << "xcpretty" parts << "--report #{type}" parts << "--output '#{output_path}'" parts << "&> /dev/null " commands[output_path] = parts.join(" ") end return commands end |
#parse_raw_file(path) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/scan/report_collector.rb', line 5 def parse_raw_file(path) raise "Couldn't find file at path '#{path}'".red unless File.exist?(path) commands = generate_commands(path) commands.each do |output_path, command| system(command) Helper.log.info("Successfully generated report at '#{output_path}'".green) if Scan.config[:open_report] and output_path.end_with?(".html") # Open the HTML file `open --hide '#{output_path}'` end end end |