Class: ExportManager
- Inherits:
-
Object
- Object
- ExportManager
- Defined in:
- lib/teuton/case_manager/export_manager.rb
Overview
Execute “export” order: Export every case report
Instance Method Summary collapse
-
#call(main_report, cases, args) ⇒ Object
Run export function.
Instance Method Details
#call(main_report, cases, args) ⇒ Object
Run export function
16 17 18 19 20 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 47 48 49 50 51 52 53 |
# File 'lib/teuton/case_manager/export_manager.rb', line 16 def call(main_report, cases, args) if args.class != Hash puts Rainbow("[ERROR] ExportManager: argument error!").red puts Rainbow("[ERROR] Fix line <export #{args}>").red puts Rainbow("[ERROR] Replace by <export format: 'txt'>").red puts "" exit 1 end # Step 1: Validate options = strings2symbols(args) if [:format].nil? [:format] = Project.value[:format] end unless Formatter.available_formats.include? [:format] puts Rainbow("[WARN] ExportManager: Unkown format!").yellow.bright puts Rainbow("[WARN] Fix line <export format: #{options[:format]}>").yellow.bright puts Rainbow("[INFO] Available formats: #{Formatter.available_formats.join(", ")}.").white.bright puts Rainbow("[INFO] Using default format <txt>.").white.bright [:format] = :txt end # Step 2: Export case reports if Project.value[:global][:tt_sequence] cases.each { |c| c.export() } else threads = [] cases.each { |c| threads << Thread.new { c.export() } } threads.each(&:join) end # Step 3: Export resume report main_report.export_resume() # Step 4: Preserve files if required preserve_files if [:preserve] == true end |