Class: Cuker::CukerCmd

Inherits:
Object
  • Object
show all
Includes:
LoggerSetup
Defined in:
lib/cuker/cuker_cmd.rb

Overview

class CukerCmd < Thor

Constant Summary collapse

PRODUCERS =
{}
PRESETS =
{}

Instance Attribute Summary

Attributes included from LoggerSetup

#log

Instance Method Summary collapse

Methods included from LoggerSetup

#init_logger, reset_appender_log_levels

Instance Method Details

#report(preset_key, feat_path = "../", report_file_name = 'sample_report', report_path_input = ".", special_tags_list = [ "@uat_done", "@cmo_done", "@tech_done", "@test_done", ], log_level = :info) ⇒ Object

desc “report PRESET_KEY [FEATURE_PATH [REPORT_PATH [REPORT_FILE_NAME [LOG_LEVEL]]]]”,

"reports parsed results into \nREPORT_PATH/REPORT_FILE_NAME \nfor all '*.feature' files in the given FEATURE_PATH\nSTDIO LOG_LEVEL adjustable\n"


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/cuker/cuker_cmd.rb', line 39

def report(preset_key,
           feat_path = "../",
           report_file_name = 'sample_report',
           report_path_input = ".",
           special_tags_list = [
               "@uat_done",
               "@cmo_done",
               "@tech_done",
               "@test_done",
           ],
           log_level = :info
)

  init_logger log_level
  output_files = []
  producers = PRESETS[preset_key]

  @log.info "Using preset: #{preset_key} => #{producers}"
  gr = GherkinRipper.new feat_path
  ast_map = gr.ast_map

  producers.each do |producer|
    report_path = File.join report_path_input, 'reports', LOG_TIME_TODAY
    msg = "producing '#{producer.to_s.upcase}' report @ '#{report_path}' - '#{report_file_name}' for Feature Files @ '#{feat_path}'\n"

    # @log.info msg
    puts msg
    model, writer = PRODUCERS[producer]

    preset_model = model == SummaryXLModel ? model.new(ast_map, special_tags_list) : model.new(ast_map)
    preset_writer = writer.new
    grr = GherkinReporter.new preset_writer, preset_model, report_path, report_file_name

    output_files << File.expand_path(grr.write)
  end
  output_files
end