teuton 2.10.8 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +65 -18
- data/docs/commands/README.md +18 -81
- data/docs/commands/check.md +66 -0
- data/docs/commands/config.md +120 -0
- data/docs/commands/help.md +37 -0
- data/docs/commands/new.md +34 -0
- data/docs/commands/readme.md +52 -0
- data/docs/commands/{run-tests.md → run.md} +1 -1
- data/docs/config_file.md +125 -0
- data/docs/devel/README.md +12 -0
- data/docs/dsl/expect.md +2 -2
- data/docs/dsl/run.md +30 -67
- data/docs/install/s-node.md +9 -7
- data/docs/install/t-node.md +18 -19
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/13-feedback.md +1 -1
- data/docs/learn/14-moodle_id.md +4 -4
- data/docs/learn/15-readme.md +14 -8
- data/docs/learn/16-include.md +21 -16
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +5 -3
- data/docs/learn/19-read_vars.md +7 -3
- data/docs/learn/20-macros.md +6 -4
- data/docs/learn/21-exit_codes.md +3 -3
- data/docs/learn/22-result.md +7 -3
- data/docs/learn/23-test-code.md +17 -7
- data/docs/learn/24-test-sql.md +19 -18
- data/docs/learn/25-expect-result.md +1 -0
- data/docs/learn/26-expect_sequence.md +12 -7
- data/docs/learn/27-run_script.md +11 -5
- data/docs/tutorial/es/nginx/README.md +546 -0
- data/lib/teuton/case/case.rb +0 -2
- data/lib/teuton/case/dsl/expect.rb +2 -2
- data/lib/teuton/case/dsl/log.rb +1 -1
- data/lib/teuton/case/dsl/run.rb +2 -3
- data/lib/teuton/case/dsl/upload.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +3 -6
- data/lib/teuton/case/execute/execute_local.rb +5 -2
- data/lib/teuton/case/execute/execute_ssh.rb +0 -1
- data/lib/teuton/case/execute/execute_telnet.rb +0 -2
- data/lib/teuton/case/play.rb +2 -2
- data/lib/teuton/case/result/result.rb +1 -3
- data/lib/teuton/case_manager/case_manager.rb +14 -17
- data/lib/teuton/case_manager/dsl.rb +4 -4
- data/lib/teuton/case_manager/export_manager.rb +22 -17
- data/lib/teuton/case_manager/{check_cases.rb → ext/check_cases.rb} +7 -6
- data/lib/teuton/case_manager/ext/hall_of_fame.rb +28 -0
- data/lib/teuton/case_manager/{report.rb → ext/report.rb} +6 -8
- data/lib/teuton/case_manager/send_manager.rb +1 -0
- data/lib/teuton/case_manager/{show_report.rb → show_resume_report.rb} +12 -26
- data/lib/teuton/case_manager/stats_manager.rb +26 -0
- data/lib/teuton/check/checker.rb +16 -8
- data/lib/teuton/check/main.rb +2 -2
- data/lib/teuton/check/show.rb +3 -3
- data/lib/teuton/cli.rb +3 -2
- data/lib/teuton/readme/dsl/getset.rb +1 -0
- data/lib/teuton/readme/main.rb +2 -2
- data/lib/teuton/readme/readme.rb +2 -2
- data/lib/teuton/report/formatter/default/array.rb +1 -3
- data/lib/teuton/report/formatter/default/markdown.rb +1 -1
- data/lib/teuton/report/formatter/default/txt.rb +1 -1
- data/lib/teuton/report/formatter/default/xml.rb +93 -29
- data/lib/teuton/report/formatter/formatter.rb +2 -1
- data/lib/teuton/report/formatter/resume/array.rb +1 -3
- data/lib/teuton/report/formatter/resume/txt.rb +6 -2
- data/lib/teuton/report/formatter/resume/xml.rb +92 -0
- data/lib/teuton/report/report.rb +1 -1
- data/lib/teuton/utils/config_file_reader.rb +141 -0
- data/lib/teuton/utils/name_file_finder.rb +12 -15
- data/lib/teuton/utils/project.rb +19 -21
- data/lib/teuton/utils/settings.rb +3 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +11 -10
- metadata +35 -30
- data/docs/commands/check-example.md +0 -53
- data/docs/es/aprender/01-cmd_new.md +0 -27
- data/docs/es/aprender/02-target.md +0 -131
- data/docs/es/aprender/README.md +0 -36
- data/docs/ideas/todo.md +0 -44
- data/docs/install/README.md +0 -38
- data/lib/teuton/case_manager/hall_of_fame.rb +0 -29
- data/lib/teuton/files/README.md +0 -9
- data/lib/teuton/utils/configfile_reader.rb +0 -135
- /data/docs/{ideas → devel}/contributions.md +0 -0
- /data/docs/{ideas → es}/Challenge-Server-Project.md +0 -0
- /data/docs/{ideas → es}/servidor-de-retos.md +0 -0
- /data/docs/{install/modes_of_use.md → modes_of_use.md} +0 -0
- /data/lib/teuton/{case_manager → deprecated}/utils.rb +0 -0
data/lib/teuton/case/play.rb
CHANGED
|
@@ -24,7 +24,7 @@ class Case
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def play_groups_in_sequence
|
|
27
|
-
verboseln "\n
|
|
27
|
+
verboseln "\n==> Running case [#{@config.get(:tt_members)}]" if get(:tt_sequence) == true
|
|
28
28
|
@groups.each do |t|
|
|
29
29
|
@action[:groupname] = t[:name]
|
|
30
30
|
instance_eval(&t[:block])
|
|
@@ -32,7 +32,7 @@ class Case
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def play_groups_in_parallel
|
|
35
|
-
verboseln "
|
|
35
|
+
verboseln "Running case [#{@config.get(:tt_members)}]"
|
|
36
36
|
@groups.each do |t|
|
|
37
37
|
verbose "* Processing [#{t[:name]}] "
|
|
38
38
|
@action[:groupname] = t[:name]
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
require_relative "../case/case"
|
|
2
1
|
require_relative "../report/report"
|
|
3
2
|
require_relative "../utils/project"
|
|
4
3
|
require_relative "../utils/verbose"
|
|
5
|
-
require_relative "
|
|
6
|
-
require_relative "
|
|
4
|
+
require_relative "ext/check_cases"
|
|
5
|
+
require_relative "ext/report"
|
|
7
6
|
require_relative "export_manager"
|
|
8
7
|
require_relative "send_manager"
|
|
9
|
-
require_relative "
|
|
10
|
-
require_relative "
|
|
11
|
-
require_relative "utils"
|
|
8
|
+
require_relative "show_resume_report"
|
|
9
|
+
require_relative "stats_manager"
|
|
12
10
|
|
|
13
11
|
# * initialize
|
|
14
12
|
# * play
|
|
@@ -18,11 +16,8 @@ require_relative "utils"
|
|
|
18
16
|
# * send_manager
|
|
19
17
|
# * show_report
|
|
20
18
|
class CaseManager
|
|
21
|
-
include Utils
|
|
22
19
|
include Verbose
|
|
23
20
|
|
|
24
|
-
attr_reader :report, :cases
|
|
25
|
-
|
|
26
21
|
def initialize
|
|
27
22
|
@cases = []
|
|
28
23
|
@report = Report.new(0)
|
|
@@ -33,21 +28,18 @@ class CaseManager
|
|
|
33
28
|
# Execute "play" order: Start every single case test
|
|
34
29
|
check_cases!
|
|
35
30
|
instance_eval(&block)
|
|
36
|
-
# Run export if user pass option command "--export=
|
|
31
|
+
# Run export if user pass option command "--export=FORMAT"
|
|
37
32
|
i = Project.value[:options]["export"]
|
|
38
33
|
export(format: i.to_sym) unless i.nil?
|
|
39
34
|
# Accept "configfile" param REVISE There exists?
|
|
40
35
|
i = Project.value[:options]["configfile"]
|
|
41
36
|
export(format: i.to_sym) unless i.nil?
|
|
37
|
+
# TODO: Export Stats
|
|
38
|
+
# StatsManager.new.call(@cases)
|
|
42
39
|
end
|
|
43
40
|
|
|
44
41
|
def export(args = {})
|
|
45
|
-
ExportManager.new.call(
|
|
46
|
-
@report,
|
|
47
|
-
@cases,
|
|
48
|
-
args,
|
|
49
|
-
Project.value[:format]
|
|
50
|
-
)
|
|
42
|
+
ExportManager.new.call(@report, @cases, args)
|
|
51
43
|
end
|
|
52
44
|
|
|
53
45
|
def send(args = {})
|
|
@@ -55,6 +47,11 @@ class CaseManager
|
|
|
55
47
|
end
|
|
56
48
|
|
|
57
49
|
def show(options = {verbose: 1})
|
|
58
|
-
|
|
50
|
+
ShowResumeReport.new(@report).call(options[:verbose])
|
|
59
51
|
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
include CheckCasesExtension
|
|
56
|
+
include ReportExtension
|
|
60
57
|
end
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
require_relative "../utils/project"
|
|
2
2
|
require_relative "case_manager"
|
|
3
3
|
|
|
4
|
-
# DSL instructions that apply
|
|
5
|
-
# Therefore, they are stored globally in the case manager.
|
|
4
|
+
# DSL instructions that apply to all cases. Stored globally in the case manager.
|
|
6
5
|
# * define_macro
|
|
7
6
|
# * group
|
|
8
7
|
# * play
|
|
@@ -38,8 +37,9 @@ def use(filename)
|
|
|
38
37
|
require_relative findfiles.first
|
|
39
38
|
Project.value[:uses] << File.basename(findfiles.first)
|
|
40
39
|
rescue => e
|
|
41
|
-
puts "[ERROR] #{e}
|
|
42
|
-
puts "
|
|
40
|
+
puts "[ERROR] case_manager/dsl: #{e}"
|
|
41
|
+
puts "[ERROR] File not found!"
|
|
42
|
+
puts "[ERROR] Fix line <use '#{filename}'>"
|
|
43
43
|
exit 1
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -13,32 +13,37 @@ class ExportManager
|
|
|
13
13
|
# @param main_report (Report)
|
|
14
14
|
# @param cases (Array)
|
|
15
15
|
# @param input (Hash) Selected export options
|
|
16
|
-
def call(main_report, cases, args
|
|
16
|
+
def call(main_report, cases, args)
|
|
17
17
|
if args.class != Hash
|
|
18
|
-
puts Rainbow("[ERROR] ExportManager:").red
|
|
19
|
-
puts Rainbow("
|
|
20
|
-
puts Rainbow("
|
|
21
|
-
puts Rainbow(" Use : export format: 'txt'").red
|
|
18
|
+
puts Rainbow("[ERROR] ExportManager: argument error!").red
|
|
19
|
+
puts Rainbow("[ERROR] Fix line <export #{args}>").red
|
|
20
|
+
puts Rainbow("[ERROR] Replace by <export format: 'txt'>").red
|
|
22
21
|
puts ""
|
|
23
22
|
exit 1
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
# Step 1: Validate options
|
|
27
26
|
options = strings2symbols(args)
|
|
28
|
-
|
|
27
|
+
if options[:format].nil?
|
|
28
|
+
options[:format] = Project.value[:format]
|
|
29
|
+
end
|
|
29
30
|
|
|
30
31
|
unless Formatter.available_formats.include? options[:format]
|
|
31
|
-
puts Rainbow("[WARN] ExportManager:").yellow.bright
|
|
32
|
-
puts Rainbow("
|
|
33
|
-
puts Rainbow("
|
|
34
|
-
puts Rainbow("[INFO] Using default format <txt>.").
|
|
32
|
+
puts Rainbow("[WARN] ExportManager: Unkown format!").yellow.bright
|
|
33
|
+
puts Rainbow("[WARN] Fix line <export format: #{options[:format]}>").yellow.bright
|
|
34
|
+
puts Rainbow("[INFO] Available formats: #{Formatter.available_formats.join(", ")}.").white.bright
|
|
35
|
+
puts Rainbow("[INFO] Using default format <txt>.").white.bright
|
|
35
36
|
options[:format] = :txt
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
# Step 2: Export case reports
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if Project.value[:global][:tt_sequence]
|
|
41
|
+
cases.each { |c| c.export(options) }
|
|
42
|
+
else
|
|
43
|
+
threads = []
|
|
44
|
+
cases.each { |c| threads << Thread.new { c.export(options) } }
|
|
45
|
+
threads.each(&:join)
|
|
46
|
+
end
|
|
42
47
|
|
|
43
48
|
# Step 3: Export resume report
|
|
44
49
|
main_report.export_resume(options)
|
|
@@ -79,10 +84,10 @@ class ExportManager
|
|
|
79
84
|
}
|
|
80
85
|
subdir = format("%<year>s%<month>02d%<day>02d-" \
|
|
81
86
|
"%<hour>02d%<min>02d%<sec>02d", data)
|
|
82
|
-
|
|
87
|
+
preserve_dir = File.join(srcdir, subdir)
|
|
83
88
|
|
|
84
|
-
puts "[INFO] Preserving files => #{
|
|
85
|
-
FileUtils.mkdir(
|
|
86
|
-
Dir.glob(File.join(srcdir, "**.*")).each { |file| FileUtils.cp(file,
|
|
89
|
+
puts "[INFO] Preserving files => #{preserve_dir}"
|
|
90
|
+
FileUtils.mkdir(preserve_dir)
|
|
91
|
+
Dir.glob(File.join(srcdir, "**.*")).each { |file| FileUtils.cp(file, preserve_dir) }
|
|
87
92
|
end
|
|
88
93
|
end
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
require "fileutils"
|
|
1
2
|
require_relative "hall_of_fame"
|
|
2
|
-
require_relative "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
private
|
|
3
|
+
require_relative "../../case/case"
|
|
4
|
+
require_relative "../../utils/config_file_reader"
|
|
5
|
+
require_relative "../../utils/project"
|
|
6
6
|
|
|
7
|
+
module CheckCasesExtension
|
|
7
8
|
def check_cases!
|
|
8
9
|
# Start checking every single case
|
|
9
10
|
app = Project.value
|
|
10
11
|
# Load configurations from config file
|
|
11
|
-
configdata = ConfigFileReader.
|
|
12
|
+
configdata = ConfigFileReader.call(Project.value[:config_path])
|
|
12
13
|
app[:ialias] = configdata[:alias]
|
|
13
14
|
app[:global] = configdata[:global]
|
|
14
15
|
app[:global][:tt_testname] = app[:global][:tt_testname] || app[:test_name]
|
|
@@ -16,7 +17,7 @@ class CaseManager
|
|
|
16
17
|
|
|
17
18
|
# Create out dir
|
|
18
19
|
outdir = app[:global][:tt_outdir] || File.join("var", app[:global][:tt_testname])
|
|
19
|
-
|
|
20
|
+
FileUtils.mkdir_p(outdir) unless Dir.exist?(outdir)
|
|
20
21
|
@report.output_dir = outdir
|
|
21
22
|
|
|
22
23
|
# Fill report head
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_relative "../../utils/project"
|
|
2
|
+
|
|
3
|
+
module CheckCasesExtension
|
|
4
|
+
class HallOfFame
|
|
5
|
+
MIN_HALL_OF_FAME = 3
|
|
6
|
+
|
|
7
|
+
def initialize(cases)
|
|
8
|
+
@cases = cases
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call
|
|
12
|
+
celebrities = {}
|
|
13
|
+
|
|
14
|
+
@cases.each do |acase|
|
|
15
|
+
next if acase.skip
|
|
16
|
+
|
|
17
|
+
grade = acase.grade
|
|
18
|
+
celebrities[grade] = "" if celebrities[grade].nil?
|
|
19
|
+
celebrities[grade] += "*"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sorted_list = celebrities.sort_by { |key, _value| key }
|
|
23
|
+
if sorted_list.size >= MIN_HALL_OF_FAME
|
|
24
|
+
Project.value[:hall_of_fame] = sorted_list.reverse
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
require "rainbow"
|
|
2
|
-
require_relative "
|
|
3
|
-
require_relative "
|
|
4
|
-
|
|
5
|
-
class CaseManager
|
|
6
|
-
private
|
|
2
|
+
require_relative "../../utils/project"
|
|
3
|
+
require_relative "../../utils/settings"
|
|
7
4
|
|
|
5
|
+
module ReportExtension
|
|
8
6
|
##
|
|
9
7
|
# Open main report (resume report)
|
|
10
8
|
# @param config_filepath (String)
|
|
@@ -13,8 +11,8 @@ class CaseManager
|
|
|
13
11
|
@report.head[:tt_scriptname] = trim(Project.value[:script_path])
|
|
14
12
|
@report.head[:tt_configfile] = trim(config_filepath)
|
|
15
13
|
@report.head[:tt_pwd] = Project.value[:running_basedir]
|
|
16
|
-
@report.head[:tt_debug] = true if
|
|
17
|
-
@report.head[:tt_uses] = Project.value[:uses].join(", ")
|
|
14
|
+
@report.head[:tt_debug] = true if Project.value[:debug]
|
|
15
|
+
@report.head[:tt_uses] = Project.value[:uses].join(", ")
|
|
18
16
|
@report.head.merge!(Project.value[:global])
|
|
19
17
|
end
|
|
20
18
|
|
|
@@ -36,7 +34,7 @@ class CaseManager
|
|
|
36
34
|
skip: true,
|
|
37
35
|
id: "-",
|
|
38
36
|
grade: 0.0,
|
|
39
|
-
letter:
|
|
37
|
+
letter: Settings.letter(:skip),
|
|
40
38
|
members: "-",
|
|
41
39
|
conn_status: {},
|
|
42
40
|
moodle_id: "",
|
|
@@ -9,7 +9,9 @@ require_relative "../utils/project"
|
|
|
9
9
|
# | 2 | Show hall of fame |
|
|
10
10
|
# | 3 | Show final values |
|
|
11
11
|
# | 4 | Show Initial values |
|
|
12
|
-
class
|
|
12
|
+
class ShowResumeReport
|
|
13
|
+
MIN_HALL_OF_FAME = 3
|
|
14
|
+
|
|
13
15
|
def initialize(report)
|
|
14
16
|
@report = report
|
|
15
17
|
end
|
|
@@ -18,7 +20,7 @@ class ShowReport
|
|
|
18
20
|
return if Project.quiet?
|
|
19
21
|
|
|
20
22
|
show_initial_configurations if verbose > 2
|
|
21
|
-
if filename.to_s.include? "resume"
|
|
23
|
+
if @report.filename.to_s.include? "resume"
|
|
22
24
|
show_resume
|
|
23
25
|
else
|
|
24
26
|
show_targets_history
|
|
@@ -29,26 +31,10 @@ class ShowReport
|
|
|
29
31
|
|
|
30
32
|
private
|
|
31
33
|
|
|
32
|
-
def filename
|
|
33
|
-
@report.filename
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def head
|
|
37
|
-
@report.head
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def lines
|
|
41
|
-
@report.lines
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def tail
|
|
45
|
-
@report.tail
|
|
46
|
-
end
|
|
47
|
-
|
|
48
34
|
def show_initial_configurations
|
|
49
35
|
puts Rainbow("INITIAL CONFIGURATIONS").bright
|
|
50
36
|
my_screen_table = Terminal::Table.new do |st|
|
|
51
|
-
head.each do |key, value|
|
|
37
|
+
@report.head.each do |key, value|
|
|
52
38
|
st.add_row [key.to_s, trim(value)]
|
|
53
39
|
end
|
|
54
40
|
end
|
|
@@ -64,7 +50,7 @@ class ShowReport
|
|
|
64
50
|
puts Rainbow("CASE RESULTS").bright
|
|
65
51
|
my_screen_table = Terminal::Table.new do |st|
|
|
66
52
|
st.add_row %w[CASE MEMBERS GRADE STATE]
|
|
67
|
-
lines.each do |line|
|
|
53
|
+
@report.lines.each do |line|
|
|
68
54
|
st.add_row [line[:id], line[:members], line[:grade], line[:letter]]
|
|
69
55
|
end
|
|
70
56
|
end
|
|
@@ -73,13 +59,13 @@ class ShowReport
|
|
|
73
59
|
|
|
74
60
|
def show_conn_status
|
|
75
61
|
errors = 0
|
|
76
|
-
lines.each { |line| errors += line[:conn_status].size }
|
|
62
|
+
@report.lines.each { |line| errors += line[:conn_status].size }
|
|
77
63
|
return if errors.zero?
|
|
78
64
|
|
|
79
65
|
puts Rainbow("CONN ERRORS").bright
|
|
80
66
|
my_screen_table = Terminal::Table.new do |st|
|
|
81
67
|
st.add_row %w[CASE MEMBERS HOST ERROR]
|
|
82
|
-
lines.each do |line|
|
|
68
|
+
@report.lines.each do |line|
|
|
83
69
|
line[:conn_status].each_pair do |host, error|
|
|
84
70
|
st.add_row [line[:id], line[:members], host, Rainbow(error).red.bright]
|
|
85
71
|
end
|
|
@@ -91,10 +77,10 @@ class ShowReport
|
|
|
91
77
|
def show_targets_history
|
|
92
78
|
tab = " "
|
|
93
79
|
puts Rainbow("CASE RESULTS").bright
|
|
94
|
-
if lines.size == 1
|
|
80
|
+
if @report.lines.size == 1
|
|
95
81
|
puts lines[0]
|
|
96
82
|
else
|
|
97
|
-
lines.each do |i|
|
|
83
|
+
@report.lines.each do |i|
|
|
98
84
|
if i.instance_of?(::Hash)
|
|
99
85
|
value = 0.0
|
|
100
86
|
value = i[:weight] if i[:check]
|
|
@@ -113,7 +99,7 @@ class ShowReport
|
|
|
113
99
|
def show_final_values
|
|
114
100
|
puts Rainbow("FINAL VALUES").bright
|
|
115
101
|
my_screen_table = Terminal::Table.new do |st|
|
|
116
|
-
tail.each do |key, value|
|
|
102
|
+
@report.tail.each do |key, value|
|
|
117
103
|
st.add_row [key.to_s, value.to_s]
|
|
118
104
|
end
|
|
119
105
|
end
|
|
@@ -122,7 +108,7 @@ class ShowReport
|
|
|
122
108
|
|
|
123
109
|
def show_hall_of_fame
|
|
124
110
|
hall_of_fame = Project.value[:hall_of_fame]
|
|
125
|
-
return if hall_of_fame.size <
|
|
111
|
+
return if hall_of_fame.size < MIN_HALL_OF_FAME
|
|
126
112
|
|
|
127
113
|
puts Rainbow("HALL OF FAME").bright
|
|
128
114
|
my_screen_table = Terminal::Table.new do |st|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative "../utils/project"
|
|
2
|
+
|
|
3
|
+
class StatsManager
|
|
4
|
+
def initialize
|
|
5
|
+
filepath = File.join(Project.value[:output_basedir], Project.value[:test_name], "stats.txt")
|
|
6
|
+
@file = File.open(filepath, "w")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def call(cases)
|
|
10
|
+
write "STATS"
|
|
11
|
+
write("Started at #{Time.new}")
|
|
12
|
+
|
|
13
|
+
# targets = {}
|
|
14
|
+
cases.each do |acase|
|
|
15
|
+
write acase.id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
write("Finished!")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def write(msg)
|
|
24
|
+
@file.write "#{msg}\n"
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/teuton/check/checker.rb
CHANGED
|
@@ -39,24 +39,32 @@ class Checker
|
|
|
39
39
|
@target_begin = nil
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def show
|
|
42
|
+
def show(onlyconfig)
|
|
43
|
+
if onlyconfig
|
|
44
|
+
show_onlyconfig
|
|
45
|
+
else
|
|
46
|
+
show_default
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
def show_default
|
|
43
53
|
Logger.verbose = true
|
|
44
54
|
process_content
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
show = ShowCheck.new(stats: @stats, path: @path)
|
|
56
|
+
show.show_stats
|
|
57
|
+
show.revise_config_content
|
|
48
58
|
end
|
|
49
59
|
|
|
50
60
|
def show_onlyconfig
|
|
51
61
|
Logger.verbose = false
|
|
52
62
|
process_content
|
|
53
63
|
Logger.verbose = true
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
show = ShowCheck.new(stats: @stats, path: @path)
|
|
65
|
+
show.suggest_config_content
|
|
56
66
|
end
|
|
57
67
|
|
|
58
|
-
private
|
|
59
|
-
|
|
60
68
|
def process_content
|
|
61
69
|
groups = Project.value[:groups]
|
|
62
70
|
option = Project.value[:options]
|
data/lib/teuton/check/main.rb
CHANGED
|
@@ -8,8 +8,8 @@ def use(filename)
|
|
|
8
8
|
files = Dir.glob(rbfiles)
|
|
9
9
|
use = []
|
|
10
10
|
files.sort.each { |f| use << f if f.include?(filename) }
|
|
11
|
-
require_relative use
|
|
12
|
-
Project.value[:uses] << use
|
|
11
|
+
require_relative use.first
|
|
12
|
+
Project.value[:uses] << Project.relative_path(use.first)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def group(name, &block)
|
data/lib/teuton/check/show.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "rainbow"
|
|
|
3
3
|
|
|
4
4
|
require_relative "../utils/logger"
|
|
5
5
|
require_relative "../utils/project"
|
|
6
|
-
require_relative "../utils/
|
|
6
|
+
require_relative "../utils/config_file_reader"
|
|
7
7
|
|
|
8
8
|
class ShowCheck
|
|
9
9
|
def initialize(stats:, path:)
|
|
@@ -14,7 +14,7 @@ class ShowCheck
|
|
|
14
14
|
def suggest_config_content
|
|
15
15
|
output = {"global" => nil, "cases" => [{}]}
|
|
16
16
|
script_vars = find_script_vars
|
|
17
|
-
script_vars.each { |i| output["cases"][0][i.to_s] = "
|
|
17
|
+
script_vars.each { |i| output["cases"][0][i.to_s] = "TOCHANGE" }
|
|
18
18
|
Logger.info YAML.dump(output)
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ class ShowCheck
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
script_vars = find_script_vars
|
|
31
|
-
config_vars = ConfigFileReader.
|
|
31
|
+
config_vars = ConfigFileReader.call(@path[:config])
|
|
32
32
|
config_vars[:global]&.each_key { |k| script_vars.delete(k) }
|
|
33
33
|
config_vars[:alias]&.each_key { |k| script_vars.delete(k) }
|
|
34
34
|
|
data/lib/teuton/cli.rb
CHANGED
|
@@ -38,11 +38,12 @@ class CLI < Thor
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
map ["co", "-co", "--config"] => "config"
|
|
41
|
-
desc "config DIRECTORY", "Suggest configuration"
|
|
41
|
+
desc "config [OPTIONS] DIRECTORY", "Suggest configuration."
|
|
42
42
|
long_desc <<~LONGDESC
|
|
43
|
-
config
|
|
43
|
+
config DIRECTORY, "Suggest the content of the configuration file based on the test"
|
|
44
44
|
LONGDESC
|
|
45
45
|
def config(projectpath)
|
|
46
|
+
# Check Test: suggest the content of the configuration file based on the test
|
|
46
47
|
opt = {"onlyconfig" => true}
|
|
47
48
|
Teuton.check(projectpath, opt)
|
|
48
49
|
end
|
data/lib/teuton/readme/main.rb
CHANGED
|
@@ -7,8 +7,8 @@ def use(filename)
|
|
|
7
7
|
files = Dir.glob(rbfiles)
|
|
8
8
|
use = []
|
|
9
9
|
files.sort.each { |f| use << f if f.include?(filename) }
|
|
10
|
-
require_relative use
|
|
11
|
-
Project.value[:uses] << use
|
|
10
|
+
require_relative use.first
|
|
11
|
+
Project.value[:uses] << use.first
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def define_macro(name, *args, &block)
|
data/lib/teuton/readme/readme.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require_relative "../utils/logger"
|
|
2
2
|
require_relative "../utils/project"
|
|
3
|
-
require_relative "../utils/
|
|
3
|
+
require_relative "../utils/config_file_reader"
|
|
4
4
|
require_relative "../case/dsl/macro"
|
|
5
5
|
require_relative "../version"
|
|
6
6
|
require_relative "dsl/all"
|
|
@@ -33,7 +33,7 @@ class Readme
|
|
|
33
33
|
private
|
|
34
34
|
|
|
35
35
|
def reset
|
|
36
|
-
@config = ConfigFileReader.
|
|
36
|
+
@config = ConfigFileReader.call(Project.value[:config_path])
|
|
37
37
|
@verbose = Project.value[:verbose]
|
|
38
38
|
@result = ReadmeResult.new
|
|
39
39
|
@data = {}
|
|
@@ -2,8 +2,6 @@ require_relative "../base_formatter"
|
|
|
2
2
|
require_relative "../../../utils/project"
|
|
3
3
|
|
|
4
4
|
class ArrayFormatter < BaseFormatter
|
|
5
|
-
MIN_HALL_OF_FAME = 3
|
|
6
|
-
|
|
7
5
|
def initialize(report)
|
|
8
6
|
super
|
|
9
7
|
@data = {}
|
|
@@ -91,7 +89,7 @@ class ArrayFormatter < BaseFormatter
|
|
|
91
89
|
|
|
92
90
|
def build_hof_data
|
|
93
91
|
@data[:hall_of_fame] = {}
|
|
94
|
-
return if Project.value[:
|
|
92
|
+
return if Project.value[:hall_of_fame].empty?
|
|
95
93
|
|
|
96
94
|
fame = {}
|
|
97
95
|
Project.value[:hall_of_fame].each { |line| fame[line[0]] = line[1] }
|