snapshot/lib/snapshot/test_command_generator.rb in fastlane-2.200.0 vs snapshot/lib/snapshot/test_command_generator.rb in fastlane-2.201.0.rc1

- old
+ new

@@ -25,13 +25,48 @@ tee_command = ['tee'] tee_command << '-a' if log_path && File.exist?(log_path) tee_command << log_path.shellescape if log_path pipe = ["| #{tee_command.join(' ')}"] - if Snapshot.config[:disable_xcpretty] - return pipe + + formatter = Snapshot.config[:xcodebuild_formatter].chomp + options = legacy_xcpretty_options + + if Snapshot.config[:disable_xcpretty] || formatter == '' + UI.verbose("Not using an xcodebuild formatter") + elsif !options.empty? + UI.important("Detected legacy xcpretty being used so formatting wth xcpretty") + UI.important("Option(s) used: #{options.join(', ')}") + pipe += pipe_xcpretty + elsif formatter == 'xcpretty' + pipe += pipe_xcpretty + elsif formatter == 'xcbeautify' + pipe += pipe_xcbeautify + else + pipe << "| #{formatter}" end + pipe + end + + def pipe_xcbeautify + pipe = ['| xcbeautify'] + + if FastlaneCore::Helper.colors_disabled? + pipe << '--disable-colored-output' + end + + return pipe + end + + def legacy_xcpretty_options + options = [] + options << "xcpretty_args" if Snapshot.config[:xcpretty_args] + return options + end + + def pipe_xcpretty + pipe = [] xcpretty = "xcpretty #{Snapshot.config[:xcpretty_args]}" xcpretty << "--no-color" if Helper.colors_disabled? pipe << "| #{xcpretty}" pipe << "> /dev/null" if Snapshot.config[:suppress_xcode_output] return pipe