teuton 3.2.1 → 3.3.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -7
  3. data/docs/commands/README.md +8 -7
  4. data/docs/commands/check.md +17 -15
  5. data/docs/commands/help.md +17 -7
  6. data/docs/devel/todo.md +1 -4
  7. data/docs/dsl/target.md +0 -14
  8. data/docs/install/t-node.md +10 -21
  9. data/docs/learn/02-target.md +49 -47
  10. data/docs/learn/03-remote_hosts.md +14 -15
  11. data/docs/learn/04-config.md +67 -68
  12. data/docs/learn/06-cmd_check.md +26 -24
  13. data/docs/learn/07-target_weight.md +3 -3
  14. data/docs/learn/08-unique_values.md +31 -29
  15. data/docs/learn/10-debug.md +36 -0
  16. data/docs/learn/13-feedback.md +10 -9
  17. data/docs/learn/15-readme.md +2 -2
  18. data/docs/learn/16-include.md +7 -7
  19. data/docs/learn/18-log.md +44 -43
  20. data/docs/learn/23-test-code.md +13 -10
  21. data/docs/learn/24-test-sql.md +5 -5
  22. data/docs/learn/26-expect_sequence.md +1 -1
  23. data/docs/learn/27-run_script.md +8 -5
  24. data/lib/teuton/case/{action.rb → action/action.rb} +18 -10
  25. data/lib/teuton/case/action/manager.rb +63 -0
  26. data/lib/teuton/case/case.rb +13 -13
  27. data/lib/teuton/case/close.rb +3 -3
  28. data/lib/teuton/case/dsl/all.rb +1 -0
  29. data/lib/teuton/case/dsl/event.rb +24 -0
  30. data/lib/teuton/case/dsl/expect.rb +5 -3
  31. data/lib/teuton/case/dsl/log.rb +3 -7
  32. data/lib/teuton/case/dsl/macro.rb +1 -1
  33. data/lib/teuton/case/dsl/run.rb +10 -15
  34. data/lib/teuton/case/dsl/target.rb +4 -2
  35. data/lib/teuton/case/play.rb +1 -1
  36. data/lib/teuton/case/result/ext_compare.rb +10 -10
  37. data/lib/teuton/case_manager/dsl.rb +6 -2
  38. data/lib/teuton/case_manager/ext/report.rb +0 -4
  39. data/lib/teuton/case_manager/show_resume_report.rb +29 -30
  40. data/lib/teuton/check/checker.rb +17 -8
  41. data/lib/teuton/check/dsl/all.rb +18 -10
  42. data/lib/teuton/check/dsl/expect.rb +29 -45
  43. data/lib/teuton/check/dsl/getset.rb +2 -2
  44. data/lib/teuton/check/dsl/run.rb +2 -2
  45. data/lib/teuton/check/show.rb +28 -34
  46. data/lib/teuton/cli/app.rb +1 -1
  47. data/lib/teuton/readme/dsl/all.rb +10 -1
  48. data/lib/teuton/readme/main.rb +2 -2
  49. data/lib/teuton/report/formatter/default/array.rb +15 -29
  50. data/lib/teuton/report/formatter/default/txt.rb +41 -30
  51. data/lib/teuton/report/formatter/resume/txt.rb +27 -26
  52. data/lib/teuton/report/formatter/resume/xml.rb +4 -4
  53. data/lib/teuton/report/report.rb +3 -1
  54. data/lib/teuton/utils/project.rb +4 -3
  55. data/lib/teuton/version.rb +1 -1
  56. metadata +4 -5
  57. data/docs/tutorial/es/nginx/README.md +0 -546
  58. data/lib/teuton/deprecated/utils.rb +0 -14
@@ -33,45 +33,31 @@ class ArrayFormatter < BaseFormatter
33
33
  groups = []
34
34
  title = nil
35
35
  targets = []
36
- @lines.each do |i|
37
- unless i.instance_of? Hash
38
- @data[:logs] << i.to_s # Add log line
36
+ @lines.each do |line|
37
+ unless line.instance_of? Hash
38
+ @data[:logs] << line.to_s # Add log line
39
39
  next
40
40
  end
41
41
 
42
- value = 0.0
43
- value = i[:weight] if i[:check]
44
- if i[:groupname] != title
42
+ # value = 0.0
43
+ # value = line[:weight] if line[:check]
44
+ if line[:groupname] != title
45
45
  # Add currentgroup
46
46
  groups << {title: title, targets: targets} unless title.nil?
47
47
  # Create new group
48
- title = i[:groupname]
48
+ title = line[:groupname]
49
49
  targets = []
50
50
  end
51
-
52
- target = {}
53
- target[:target_id] = format("%<id>02d", id: i[:id])
54
- target[:check] = i[:check]
55
- target[:score] = value
56
- target[:weight] = i[:weight]
57
- target[:description] = i[:description]
58
-
59
- target[:conn_type] = i[:conn_type]
60
- target[:duration] = i[:duration]
61
-
62
- target[:command] = i[:command]
63
- target[:output] = i[:output]
64
- target[:alterations] = i[:alterations]
65
- target[:expected] = i[:expected]
66
- target[:result] = i[:result]
51
+ target = line
52
+ target[:target_id] = format("%<id>02d", id: line[:id])
67
53
 
68
54
  if options[:feedback] == false
69
- target[:command] = "*" * i[:command].size
70
- i[:output] = "" if i[:output].nil?
71
- target[:output] = "*" * i[:output].size
72
- target[:alterations] = "*" * i[:alterations].size
73
- target[:expected] = "*" * i[:expected].size
74
- target[:result] = "*" * i[:result].size
55
+ target[:command] = "*" * line[:command].size
56
+ line[:output] = "" if line[:output].nil?
57
+ target[:output] = "*" * line[:output].size
58
+ target[:alterations] = "*" * line[:alterations].size
59
+ target[:expected] = "*" * line[:expected].size
60
+ target[:result] = "*" * line[:result].size
75
61
  end
76
62
 
77
63
  targets << target
@@ -23,44 +23,43 @@ class TXTFormatter < ArrayFormatter
23
23
  private
24
24
 
25
25
  def process_config
26
- w "#{colorize("CONFIGURATION", :bg_blue)}\n"
27
- my_screen_table = Terminal::Table.new do |st|
28
- @data[:config].sort.each do |key, value|
29
- st.add_row [key.to_s, value.to_s]
30
- end
26
+ w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
27
+ table = Terminal::Table.new do |t|
28
+ t.style = {border: :unicode}
29
+ @data[:config].sort.each { |key, value| t.add_row [key.to_s, value.to_s] }
31
30
  end
32
- w "#{my_screen_table}\n\n"
31
+ w "#{table}\n\n"
33
32
  end
34
33
 
35
34
  def process_logs
36
35
  return if @data[:logs].empty?
37
36
 
38
- w "#{colorize("LOGS", :bg_blue)}\n"
39
- @data[:logs].each { |line| w " #{line}\n" }
37
+ w "#{colorize(" LOGS", :bg_blue)}\n"
38
+ @data[:logs].each { |line| w " #{line}\n" }
40
39
  end
41
40
 
42
41
  def process_groups
43
42
  return if @data[:groups].empty?
44
43
 
45
- w "\n#{colorize("GROUPS", :bg_blue)}\n"
44
+ w "\n#{colorize(" GROUPS", :bg_blue)}\n"
46
45
  @data[:groups].each { |g| process_group g }
47
46
  end
48
47
 
49
48
  def process_results
50
- w "\n#{colorize("RESULTS", :bg_blue)}\n"
51
- my_screen_table = Terminal::Table.new do |st|
52
- @data[:results].each do |key, value|
53
- st.add_row [key.to_s, value.to_s]
54
- end
49
+ w "\n#{colorize(" RESULTS", :bg_blue)}\n"
50
+ table = Terminal::Table.new do |t|
51
+ t.style = {border: :unicode}
52
+ @data[:results].each { |key, value| t.add_row [key.to_s, value.to_s] }
55
53
  end
56
- w "#{my_screen_table}\n"
54
+ w "#{table}\n"
57
55
  end
58
56
 
59
57
  def process_hof
60
58
  return if @data[:hall_of_fame].empty?
61
59
 
62
- w "\n#{colorize("HALL OF FAME", :bg_blue)}\n"
63
- my_screen_table = Terminal::Table.new do |st|
60
+ w "\n#{colorize(" HALL OF FAME", :bg_blue)}\n"
61
+ my_screen_table = Terminal::Table.new do |t|
62
+ t.style = {border: :unicode}
64
63
  @data[:hall_of_fame].each do |line|
65
64
  color = :green
66
65
  color = :red if line[0] < 50
@@ -70,7 +69,7 @@ class TXTFormatter < ArrayFormatter
70
69
  text1 = colorize(text1, :bright)
71
70
  text2 = colorize(text2, :bright)
72
71
  end
73
- st.add_row [text1, text2]
72
+ t.add_row [text1, text2]
74
73
  end
75
74
  end
76
75
  w "#{my_screen_table}\n"
@@ -80,21 +79,33 @@ class TXTFormatter < ArrayFormatter
80
79
 
81
80
  def process_group(group)
82
81
  tab = " "
83
- w "- #{colorize(group[:title], :blue_bright)}\n"
82
+ w " \u{25B6} #{colorize(group[:title], :blue_bright)}\n"
83
+ corner = nil
84
84
  group[:targets].each do |i|
85
- color = :red
86
- color = :green if i[:check]
87
- w tab * 2 + format("%02d", i[:target_id].to_i)
85
+ if i[:check]
86
+ color = :green
87
+ symbol = Settings.letter[:ok]
88
+ else
89
+ color = :red
90
+ symbol = Settings.letter[:cross]
91
+ end
92
+ w tab * 1 + format(" #{symbol} %02d", i[:target_id].to_i)
88
93
  text = "#{i[:score]}/#{i[:weight]}"
89
- w " (#{colorize(text, color)})\n"
90
- w "#{tab * 4}Description : #{i[:description]}\n"
91
- w "#{tab * 4}Command : #{i[:command]}\n"
92
- w "#{tab * 4}Output : #{i[:output]}\n"
93
- w "#{tab * 4}Duration : #{i[:duration]} (#{i[:conn_type]})\n"
94
- w "#{tab * 4}Alterations : #{i[:alterations]}\n"
95
- w "#{tab * 4}Expected : #{i[:expected]}\n"
96
- w "#{tab * 4}Result : #{i[:result]}\n"
94
+ corner = if corner.nil?
95
+ "┌──"
96
+ else
97
+ "├──"
98
+ end
99
+ w " (#{colorize(text, color)}) #{corner}\n"
100
+ w "#{tab * 4}Description │ #{i[:description]}\n"
101
+ w "#{tab * 4}Command │ #{i[:command]}\n"
102
+ w "#{tab * 4}Output │ #{i[:output]}\n"
103
+ w "#{tab * 4}Duration │ #{i[:duration]} (#{i[:conn_type]})\n"
104
+ w "#{tab * 4}Alterations │ #{i[:alterations]}\n"
105
+ w "#{tab * 4}Expected │ #{i[:expected]}\n"
106
+ w "#{tab * 4}Result │ #{i[:result]}\n"
97
107
  end
108
+ w "#{tab * 10}└──"
98
109
  end
99
110
 
100
111
  def colorize(text, option)
@@ -25,21 +25,21 @@ class ResumeTXTFormatter < ResumeArrayFormatter
25
25
  private
26
26
 
27
27
  def process_config
28
- w "#{colorize("CONFIGURATION", :bg_blue)}\n"
29
- my_screen_table = Terminal::Table.new do |st|
30
- @data[:config].each do |key, value|
31
- st.add_row [key.to_s, trim(value)]
32
- end
28
+ w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
29
+ table = Terminal::Table.new do |t|
30
+ t.style = {border: :unicode}
31
+ @data[:config].each { |key, value| t.add_row [key.to_s, trim(value)] }
33
32
  end
34
- w "#{my_screen_table}\n\n"
33
+ w "#{table}\n\n"
35
34
  end
36
35
 
37
36
  def process_cases
38
- w "#{colorize("CASES", :bg_blue)}\n"
39
- my_screen_table = Terminal::Table.new do |st|
40
- st.add_row %w[CASE MEMBERS GRADE STATE]
37
+ w "#{colorize(" CASES", :bg_blue)}\n"
38
+ table = Terminal::Table.new do |t|
39
+ t.style = {border: :unicode}
40
+ t.add_row %w[CASE MEMBERS GRADE STATE]
41
41
  @data[:cases].each do |line|
42
- st.add_row [
42
+ t.add_row [
43
43
  line[:id],
44
44
  line[:members],
45
45
  format(" %<grade>3d", {grade: line[:grade]}),
@@ -47,38 +47,39 @@ class ResumeTXTFormatter < ResumeArrayFormatter
47
47
  ]
48
48
  end
49
49
  end
50
- w "#{my_screen_table}\n\n"
50
+ w "#{table}\n\n"
51
51
  end
52
52
 
53
53
  def process_conn_errors
54
- my_screen_table = Terminal::Table.new do |st|
55
- st.add_row %w[CASE MEMBERS HOST ERROR]
54
+ table = Terminal::Table.new do |t|
55
+ t.style = {border: :unicode}
56
+ t.add_row %w[CASE MEMBERS HOST ERROR]
56
57
  @data[:cases].each do |line|
57
58
  line[:conn_status].each_pair do |h, e|
58
- st.add_row [line[:id], line[:members], h, colorize(e, :red_bright)]
59
+ t.add_row [line[:id], line[:members], h, colorize(e, :red_bright)]
59
60
  end
60
61
  end
61
62
  end
62
- return unless my_screen_table.rows.size > 1
63
+ return unless table.rows.size > 1
63
64
 
64
- w "#{colorize("CONN ERRORS", :bg_blue)}\n#{my_screen_table}\n\n"
65
+ w "#{colorize(" CONN ERRORS", :bg_blue)}\n#{table}\n\n"
65
66
  end
66
67
 
67
68
  def process_results
68
- w "#{colorize("RESULTS", :bg_blue)}\n"
69
- my_screen_table = Terminal::Table.new do |st|
70
- @data[:results].each do |key, value|
71
- st.add_row [key.to_s, value.to_s]
72
- end
69
+ w "#{colorize(" RESULTS", :bg_blue)}\n"
70
+ table = Terminal::Table.new do |t|
71
+ t.style = {border: :unicode}
72
+ @data[:results].each { |key, value| t.add_row([key.to_s, value.to_s]) }
73
73
  end
74
- w "#{my_screen_table}\n\n"
74
+ w "#{table}\n\n"
75
75
  end
76
76
 
77
77
  def process_hof
78
78
  return if @data[:hall_of_fame].size < MIN_HALL_OF_FAME
79
79
 
80
- w "#{colorize("HALL OF FAME", :bg_blue)}\n"
81
- my_screen_table = Terminal::Table.new do |st|
80
+ w "#{colorize(" HALL OF FAME", :bg_blue)}\n"
81
+ table = Terminal::Table.new do |t|
82
+ t.style = {border: :unicode}
82
83
  @data[:hall_of_fame].each do |line|
83
84
  color = :green
84
85
  color = :red if line[0] < 50
@@ -88,10 +89,10 @@ class ResumeTXTFormatter < ResumeArrayFormatter
88
89
  text1 = colorize(text1, :bright)
89
90
  text2 = colorize(text2, :bright)
90
91
  end
91
- st.add_row [text1, text2]
92
+ t.add_row [text1, text2]
92
93
  end
93
94
  end
94
- w "#{my_screen_table}\n"
95
+ w "#{table}\n"
95
96
  end
96
97
 
97
98
  def colorize(text, option)
@@ -61,10 +61,10 @@ class ResumeXMLFormatter < ResumeArrayFormatter
61
61
  end
62
62
  lines << " </conn_errors>"
63
63
 
64
- if lines.size > 2
65
- w lines.join("\n")
66
- w "\n"
67
- end
64
+ return unless lines.size > 2
65
+
66
+ w lines.join("\n")
67
+ w "\n\n"
68
68
  end
69
69
 
70
70
  def process_results
@@ -9,10 +9,12 @@ class Report
9
9
  def initialize(id = "00")
10
10
  @id = id
11
11
  @filename = "case-#{@id}"
12
- @output_dir = Project.value[:output_basedir]
12
+ @output_dir = Project.value[:output_dir]
13
+
13
14
  @head = {}
14
15
  @lines = []
15
16
  @tail = {unique_fault: 0}
17
+ # TODO
16
18
  # [String] with 1 char for every target in @lines
17
19
  # For example: "..F." means: good, good, fail and good
18
20
  @history = ""
@@ -8,6 +8,7 @@ class Project
8
8
  @project[:running_basedir] = Dir.getwd
9
9
  @project[:output_basedir] = "var"
10
10
  @project[:output_dir] = @project[:output_basedir]
11
+ @project[:base_case_id] = "00"
11
12
  @project[:name] = "teuton"
12
13
  @project[:format] = :txt # Default export format
13
14
  @project[:debug] = false # Disable/enable local executions
@@ -18,12 +19,12 @@ class Project
18
19
  "quiet" => false
19
20
  }
20
21
  @project[:verbose] = true # Enable/disable screen outputs
21
- @project[:global] = {}
22
22
  @project[:ialias] = {} # Hash of Internal alias
23
- @project[:macros] = {}
23
+ @project[:global] = {}
24
24
  @project[:groups] = []
25
- @project[:uses] = []
26
25
  @project[:hall_of_fame] = [] # Hall of fame content
26
+ @project[:macros] = {}
27
+ @project[:uses] = []
27
28
  end
28
29
 
29
30
  def self.value
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "3.2.1".freeze
2
+ VERSION = "3.3.0".freeze
3
3
  APPNAME = "teuton".freeze
4
4
  GEMNAME = "teuton".freeze
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}".freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
@@ -184,7 +184,6 @@ extra_rdoc_files:
184
184
  - docs/learn/README.md
185
185
  - docs/modes_of_use.md
186
186
  - docs/more.md
187
- - docs/tutorial/es/nginx/README.md
188
187
  files:
189
188
  - LICENSE
190
189
  - README.md
@@ -250,9 +249,9 @@ files:
250
249
  - docs/learn/README.md
251
250
  - docs/modes_of_use.md
252
251
  - docs/more.md
253
- - docs/tutorial/es/nginx/README.md
254
252
  - lib/teuton.rb
255
- - lib/teuton/case/action.rb
253
+ - lib/teuton/case/action/action.rb
254
+ - lib/teuton/case/action/manager.rb
256
255
  - lib/teuton/case/builtin/main.rb
257
256
  - lib/teuton/case/builtin/package.rb
258
257
  - lib/teuton/case/builtin/service.rb
@@ -263,6 +262,7 @@ files:
263
262
  - lib/teuton/case/close.rb
264
263
  - lib/teuton/case/config.rb
265
264
  - lib/teuton/case/dsl/all.rb
265
+ - lib/teuton/case/dsl/event.rb
266
266
  - lib/teuton/case/dsl/expect.rb
267
267
  - lib/teuton/case/dsl/expect_exitcode.rb
268
268
  - lib/teuton/case/dsl/expect_sequence.rb
@@ -308,7 +308,6 @@ files:
308
308
  - lib/teuton/check/show.rb
309
309
  - lib/teuton/cli/app.rb
310
310
  - lib/teuton/cli/run.rb
311
- - lib/teuton/deprecated/utils.rb
312
311
  - lib/teuton/errors.rb
313
312
  - lib/teuton/files/config.yaml
314
313
  - lib/teuton/files/start.rb