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
@@ -4,31 +4,26 @@ require_relative "../execute/execute_manager"
4
4
 
5
5
  module DSL
6
6
  ##
7
- # DSL run and goto
8
- # run: It's the same as goto :localhost
7
+ # DSL run
9
8
  # @param command (String)
10
9
  # @param args (Hash)
11
10
  def run(command, args = {})
12
- args[:exec] = command.to_s
13
- host = args[:on] || :localhost
14
- goto(host, args)
15
- end
11
+ @action.command = command.to_s
12
+ @action.host = args[:on] || :localhost
13
+ @action.encoding = args[:encoding] || "UTF-8"
16
14
 
17
- # Run command from the host identify as "host"
18
- # goto :host1, execute: "command"
19
- def goto(host = :localhost, args = {})
20
15
  @result.reset
21
- args[:on] = host unless args[:on]
22
- @action.command = args[:execute].to_s if args[:execute]
23
- @action.command = args[:exec].to_s if args[:exec]
24
- @action.encoding = args[:encoding] || "UTF-8"
25
16
 
26
- ExecuteManager.new(self).call(host)
17
+ ExecuteManager.new(self).call(@action.host)
27
18
  @action.output = if @result.content.size < 2
28
19
  @result.value.clone
29
20
  else
30
21
  "(#{@result.content.size} lines)"
31
22
  end
32
23
  end
33
- alias_method :on, :goto
24
+
25
+ def goto(...)
26
+ Logger.warn "Keyword DSL deprecated! <goto>"
27
+ run(...)
28
+ end
34
29
  end
@@ -9,10 +9,12 @@ module DSL
9
9
 
10
10
  def target(desc, args = {})
11
11
  @action.description = desc.to_s
12
- @action.asset = args[:asset].to_s if args[:asset]
13
12
  w = args[:weight] || 1.0
14
13
  weight(w)
15
14
  end
16
15
 
17
- alias_method :goal, :target # DEPRECATE
16
+ def goal(...)
17
+ Logger.warn("Keyword deprecated: Replace 'goal' by 'target'.")
18
+ target(...)
19
+ end
18
20
  end
@@ -12,7 +12,7 @@ class Case
12
12
  fill_report(start_time, Time.now)
13
13
  close_opened_sessions
14
14
  end
15
- alias_method :start, :play
15
+ # alias_method :start, :play
16
16
 
17
17
  private
18
18
 
@@ -32,8 +32,8 @@ class Result
32
32
  case external.class.to_s
33
33
  when "Fixnum"
34
34
  internal = @content[0].to_i
35
- puts "[WARN] Fixnum class is deprecated!"
36
- puts " Upgrade your Ruby version."
35
+ Logger.warn "Fixnum class is deprecated!"
36
+ Logger.warn "- Upgrade your Ruby version."
37
37
  when "Float"
38
38
  internal = @content[0].to_f
39
39
  when "Integer"
@@ -55,8 +55,8 @@ class Result
55
55
  case input.class.to_s
56
56
  when "Fixnum"
57
57
  value = @content[0].to_i
58
- puts "[WARN] Fixnum class is deprecated!"
59
- puts " Upgrade your Ruby version."
58
+ Logger.warn "Fixnum class is deprecated!"
59
+ Logger.warn "Upgrade your Ruby version."
60
60
  when "Float"
61
61
  value = @content[0].to_f
62
62
  when "Integer"
@@ -75,8 +75,8 @@ class Result
75
75
  case input.class.to_s
76
76
  when "Fixnum"
77
77
  value = @content[0].to_i
78
- puts "[WARN] Fixnum class is deprecated!"
79
- puts " Upgrade your Ruby version."
78
+ Logger.warn "Fixnum class is deprecated!"
79
+ Logger.warn "Upgrade your Ruby version."
80
80
  when "Float"
81
81
  value = @content[0].to_f
82
82
  when "Integer"
@@ -96,8 +96,8 @@ class Result
96
96
  case input.class.to_s
97
97
  when "Fixnum"
98
98
  value = @content[0].to_i
99
- puts "[WARN] Fixnum class is deprecated!"
100
- puts " Upgrade your Ruby version."
99
+ Logger.warn "Fixnum class is deprecated!"
100
+ Logger.warn "Upgrade your Ruby version."
101
101
  when "Float"
102
102
  value = @content[0].to_f
103
103
  when "Integer"
@@ -116,8 +116,8 @@ class Result
116
116
  case input.class.to_s
117
117
  when "Fixnum"
118
118
  value = @content[0].to_i
119
- puts "[WARN] Fixnum class is deprecated!"
120
- puts " Upgrade your Ruby version."
119
+ Logger.warn "Fixnum class is deprecated!"
120
+ Logger.warn "Upgrade your Ruby version."
121
121
  when "Float"
122
122
  value = @content[0].to_f
123
123
  when "Integer"
@@ -16,14 +16,18 @@ alias defmacro define_macro
16
16
  def group(name, &block)
17
17
  Project.value[:groups] << { name: name, block: block }
18
18
  end
19
- alias task group
19
+
20
+ def task(...)
21
+ Logger.warn("Keyword deprecated: Replace 'task' by 'group'.")
22
+ group(...)
23
+ end
20
24
 
21
25
  def play(&block)
22
26
  CaseManager.new.play(&block)
23
27
  end
24
28
 
25
29
  def start(...)
26
- Logger.warn "[DEPRECATED] Replace 'start do' by `play do'"
30
+ Logger.warn "Keywaord deprecaed: Replace 'start do' by `play do'"
27
31
  play(...)
28
32
  end
29
33
 
@@ -57,10 +57,6 @@ module ReportExtension
57
57
  end
58
58
  end
59
59
 
60
- ##
61
- # Trim string text when is too long
62
- # @param input (String)
63
- # @return String
64
60
  def trim(input)
65
61
  return input unless input.to_s.start_with? Dir.pwd.to_s
66
62
  return input if input == Dir.pwd.to_s
@@ -32,13 +32,12 @@ class ShowResumeReport
32
32
  private
33
33
 
34
34
  def show_initial_configurations
35
- puts Rainbow("INITIAL CONFIGURATIONS").bright
36
- my_screen_table = Terminal::Table.new do |st|
37
- @report.head.each do |key, value|
38
- st.add_row [key.to_s, trim(value)]
39
- end
35
+ Logger.puts Rainbow(" INITIAL CONFIGURATIONS").bright
36
+ table = Terminal::Table.new do |t|
37
+ t.style = {border: :unicode}
38
+ @report.head.each { |key, value| t.add_row [key.to_s, trim(value)] }
40
39
  end
41
- puts "#{my_screen_table}\n\n"
40
+ Logger.puts "#{table}\n\n"
42
41
  end
43
42
 
44
43
  def show_resume
@@ -47,14 +46,15 @@ class ShowResumeReport
47
46
  end
48
47
 
49
48
  def show_case_list
50
- puts Rainbow("CASE RESULTS").bright
51
- my_screen_table = Terminal::Table.new do |st|
52
- st.add_row %w[CASE MEMBERS GRADE STATE]
49
+ Logger.puts Rainbow(" CASE RESULTS").bright
50
+ table = Terminal::Table.new do |t|
51
+ t.style = {border: :unicode}
52
+ t.add_row %w[CASE MEMBERS GRADE STATE]
53
53
  @report.lines.each do |line|
54
- st.add_row [line[:id], line[:members], line[:grade], line[:letter]]
54
+ t.add_row [line[:id], line[:members], line[:grade], line[:letter]]
55
55
  end
56
56
  end
57
- puts "#{my_screen_table}\n\n"
57
+ Logger.puts "#{table}\n\n"
58
58
  end
59
59
 
60
60
  def show_conn_status
@@ -62,21 +62,22 @@ class ShowResumeReport
62
62
  @report.lines.each { |line| errors += line[:conn_status].size }
63
63
  return if errors.zero?
64
64
 
65
- puts Rainbow("CONN ERRORS").bright
66
- my_screen_table = Terminal::Table.new do |st|
67
- st.add_row %w[CASE MEMBERS HOST ERROR]
65
+ Logger.puts Rainbow(" CONN ERRORS").bright
66
+ table = Terminal::Table.new do |t|
67
+ t.style = {border: :unicode}
68
+ t.add_row %w[CASE MEMBERS HOST ERROR]
68
69
  @report.lines.each do |line|
69
70
  line[:conn_status].each_pair do |host, error|
70
- st.add_row [line[:id], line[:members], host, Rainbow(error).red.bright]
71
+ t.add_row [line[:id], line[:members], host, Rainbow(error).blue.bright]
71
72
  end
72
73
  end
73
74
  end
74
- puts "#{my_screen_table}\n\n"
75
+ Logger.puts "#{table}\n\n"
75
76
  end
76
77
 
77
78
  def show_targets_history
78
79
  tab = " "
79
- puts Rainbow("CASE RESULTS").bright
80
+ Logger.puts Rainbow(" CASE RESULTS").bright
80
81
  if @report.lines.size == 1
81
82
  puts lines[0]
82
83
  else
@@ -93,30 +94,28 @@ class ShowResumeReport
93
94
  end
94
95
  end
95
96
  end
96
- puts "\n\n"
97
+ Logger.puts "\n\n"
97
98
  end
98
99
 
99
100
  def show_final_values
100
- puts Rainbow("FINAL VALUES").bright
101
- my_screen_table = Terminal::Table.new do |st|
102
- @report.tail.each do |key, value|
103
- st.add_row [key.to_s, value.to_s]
104
- end
101
+ Logger.puts Rainbow(" FINAL VALUES").bright
102
+ table = Terminal::Table.new do |t|
103
+ t.style = {border: :unicode}
104
+ @report.tail.each { |key, value| t.add_row [key.to_s, value.to_s] }
105
105
  end
106
- puts "#{my_screen_table}\n\n"
106
+ Logger.puts "#{table}\n\n"
107
107
  end
108
108
 
109
109
  def show_hall_of_fame
110
110
  hall_of_fame = Project.value[:hall_of_fame]
111
111
  return if hall_of_fame.size < MIN_HALL_OF_FAME
112
112
 
113
- puts Rainbow("HALL OF FAME").bright
114
- my_screen_table = Terminal::Table.new do |st|
115
- hall_of_fame.each do |line|
116
- st.add_row [line[0], line[1]]
117
- end
113
+ Logger.puts Rainbow(" HALL OF FAME").bright
114
+ table = Terminal::Table.new do |t|
115
+ t.style = {border: :unicode}
116
+ hall_of_fame.each { |line| t.add_row [line[0], line[1]] }
118
117
  end
119
- puts "#{my_screen_table}\n\n"
118
+ Logger.puts "#{table}\n\n"
120
119
  end
121
120
 
122
121
  def trim(input)
@@ -28,6 +28,7 @@ class Checker
28
28
  @stats = {
29
29
  groups: 0,
30
30
  targets: 0,
31
+ events: 0,
31
32
  logs: 0,
32
33
  readmes: 0,
33
34
  uniques: 0,
@@ -69,22 +70,30 @@ class Checker
69
70
  groups = Project.value[:groups]
70
71
  option = Project.value[:options]
71
72
 
72
- Logger.info ""
73
+ Logger.puts ""
73
74
  if Project.value[:uses].size.positive?
74
- Logger.info Terminal::Table.new { |st| st.add_row ["USE: external libraries"] }
75
- Project.value[:uses].each_with_index { Logger.info " #{_2 + 1}. #{_1}" }
75
+ table = Terminal::Table.new do |t|
76
+ t.style = {border: :unicode}
77
+ t.add_row ["USE: external libraries"]
78
+ end
79
+ Logger.puts table
80
+ Project.value[:uses].each_with_index { Logger.puts " #{_2 + 1}. #{_1}" }
81
+ Logger.puts ""
76
82
  end
77
83
  groups.each do |t|
78
84
  @stats[:groups] += 1
79
85
  unless option[:panel]
80
86
  msg = "GROUP: #{t[:name]}"
81
- my_screen_table = Terminal::Table.new { |st| st.add_row [msg] }
82
- Logger.info my_screen_table
87
+ table = Terminal::Table.new do |t|
88
+ t.style = {border: :unicode}
89
+ t.add_row [msg]
90
+ end
91
+ Logger.puts table
83
92
  end
84
93
  instance_eval(&t[:block])
85
94
  end
86
- if @target_begin
87
- Logger.warn "WARN Last 'target' requires 'expect'\n"
88
- end
95
+ return unless @target_begin
96
+
97
+ Logger.warn "Last 'target' requires 'expect'\n"
89
98
  end
90
99
  end
@@ -4,34 +4,42 @@ require_relative "getset"
4
4
  require_relative "run"
5
5
 
6
6
  module CheckDSL
7
+ def event(**args) # , &block)
8
+ @stats[:events] += 1
9
+ # args = on: XXX, when: XXX
10
+ Logger.puts " event on: #{args[:on]}, when: #{args[:when]}"
11
+ end
12
+
7
13
  def log(text = "", type = :info)
8
14
  @stats[:logs] += 1
9
15
  prefix = (type == :info) ? "" : "#{type.to_s.upcase}: "
10
- Logger.info " log #{prefix}" + text.to_s
16
+ Logger.puts " log #{prefix}" + text.to_s
11
17
  end
12
18
 
13
19
  def readme(text)
14
20
  @stats[:readmes] += 1
15
- Logger.info " readme #{text}"
21
+ Logger.puts " readme #{text}"
16
22
  end
17
23
 
18
24
  def target(desc, args = {})
19
- if @target_begin
20
- Logger.warn "WARN Previous 'target' requires 'expect'"
21
- end
25
+ Logger.warn "WARN Previous 'target' requires 'expect'" if @target_begin
22
26
  @target_begin = true
23
27
  @stats[:targets] += 1
24
28
  @targetid += 1
25
29
  weight = args[:weight] ? args[:weight].to_f : 1.0
26
- Logger.info format("(%03<targetid>d) target %<desc>s", targetid: @targetid, desc: desc)
27
- Logger.info " weight #{weight}"
30
+ Logger.puts format("(%03<targetid>d) target %<desc>s", targetid: @targetid, desc: desc)
31
+ Logger.puts " weight #{weight}"
32
+ end
33
+
34
+ def goal(...)
35
+ Logger.warn("Keyword deprecated: Replace 'goal' by 'target'.")
36
+ target(...)
28
37
  end
29
- alias_method :goal, :target
30
38
 
31
39
  def unique(key, _value)
32
40
  @stats[:uniques] += 1
33
41
 
34
- Logger.info " unique value for <#{key}>"
35
- Logger.info ""
42
+ Logger.puts " unique value for <#{key}>"
43
+ Logger.puts ""
36
44
  end
37
45
  end
@@ -2,60 +2,48 @@ require_relative "expect_sequence"
2
2
 
3
3
  module CheckDSL
4
4
  def expect(cond)
5
- unless @target_begin
6
- Logger.warn "WARN 'expect' with no previous 'target'"
7
- end
8
- Logger.info " alter #{result.alterations}" unless result.alterations.empty?
9
- Logger.info " expect #{cond} (#{cond.class})"
10
- Logger.info ""
5
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
6
+ Logger.puts " alter #{result.alterations}" unless result.alterations.empty?
7
+ Logger.puts " expect #{cond} (#{cond.class})"
8
+ Logger.puts ""
11
9
  @target_begin = false
12
10
  end
13
11
 
14
12
  def expect_exit(cond)
15
- unless @target_begin
16
- Logger.warn "WARN 'expect' with no previous 'target'"
17
- end
18
- Logger.info " expect_exit #{cond} (#{cond.class})"
19
- Logger.info ""
13
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
14
+ Logger.puts " expect_exit #{cond} (#{cond.class})"
15
+ Logger.puts ""
20
16
  @target_begin = false
21
17
  end
22
18
 
23
19
  def expect_fail
24
- unless @target_begin
25
- Logger.warn "WARN 'expect' with no previous 'target'"
26
- end
27
- Logger.info " expect_fail"
28
- Logger.info ""
20
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
21
+ Logger.puts " expect_fail"
22
+ Logger.puts ""
29
23
  @target_begin = false
30
24
  end
31
25
 
32
26
  def expect_first(cond)
33
- unless @target_begin
34
- Logger.warn "WARN 'expect' with no previous 'target'"
35
- end
36
- Logger.info " alter #{result.alterations}" unless result.alterations.empty?
37
- Logger.info " expect_first #{cond} (#{cond.class})"
38
- Logger.info ""
27
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
28
+ Logger.puts " alter #{result.alterations}" unless result.alterations.empty?
29
+ Logger.puts " expect_first #{cond} (#{cond.class})"
30
+ Logger.puts ""
39
31
  @target_begin = false
40
32
  end
41
33
 
42
34
  def expect_last(cond)
43
- unless @target_begin
44
- Logger.warn "WARN 'expect' with no previous 'target'"
45
- end
46
- Logger.info " alter #{result.alterations}" unless result.alterations.empty?
47
- Logger.info " expect_last #{cond} (#{cond.class})"
48
- Logger.info ""
35
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
36
+ Logger.puts " alter #{result.alterations}" unless result.alterations.empty?
37
+ Logger.puts " expect_last #{cond} (#{cond.class})"
38
+ Logger.puts ""
49
39
  @target_begin = false
50
40
  end
51
41
 
52
42
  def expect_none(cond = nil, args = {})
53
- unless @target_begin
54
- Logger.warn "WARN 'expect' with no previous 'target'"
55
- end
56
- Logger.info " alter #{result.alterations}" unless result.alterations.empty?
57
- Logger.info " expect_none #{cond} (#{cond.class})"
58
- Logger.info ""
43
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
44
+ Logger.puts " alter #{result.alterations}" unless result.alterations.empty?
45
+ Logger.puts " expect_none #{cond} (#{cond.class})"
46
+ Logger.puts ""
59
47
  @target_begin = false
60
48
  end
61
49
 
@@ -68,23 +56,19 @@ module CheckDSL
68
56
  end
69
57
 
70
58
  def expect_one(cond)
71
- unless @target_begin
72
- Logger.warn "WARN 'expect' with no previous 'target'"
73
- end
74
- Logger.info " alter #{result.alterations}" unless result.alterations.empty?
75
- Logger.info " expect_one #{cond} (#{cond.class})"
76
- Logger.info ""
59
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
60
+ Logger.puts " alter #{result.alterations}" unless result.alterations.empty?
61
+ Logger.puts " expect_one #{cond} (#{cond.class})"
62
+ Logger.puts ""
77
63
  @target_begin = false
78
64
  end
79
65
 
80
66
  def expect_sequence(&block)
81
- unless @target_begin
82
- Logger.warn "WARN 'expect' with no previous 'target'"
83
- end
67
+ Logger.warn "WARN 'expect' with no previous 'target'" unless @target_begin
84
68
  seq = CheckDSL::ExpectSequence.new
85
69
  seq.is_valid?(&block)
86
- Logger.info " expect_sequence #{seq.expected}"
87
- Logger.info ""
70
+ Logger.puts " expect_sequence #{seq.expected}"
71
+ Logger.puts ""
88
72
  @target_begin = false
89
73
  end
90
74
  end
@@ -14,10 +14,10 @@ module CheckDSL
14
14
  value = ":" + value.to_s if value.instance_of? Symbol
15
15
 
16
16
  @stats[:sets] << "#{key}=#{value}"
17
- Logger.info " set(#{key},#{value})"
17
+ Logger.puts " set(#{key},#{value})"
18
18
  end
19
19
 
20
20
  def unset(key)
21
- Logger.info " unset(#{key})"
21
+ Logger.puts " unset(#{key})"
22
22
  end
23
23
  end
@@ -17,7 +17,7 @@ module CheckDSL
17
17
  def goto(host = :localhost, args = {})
18
18
  result.reset
19
19
  @stats[:hosts][host] = @stats[:hosts][host] ? (@stats[:hosts][host] + 1) : 1
20
- Logger.info " run '#{args[:exec]}' on #{host}"
20
+ Logger.puts " run '#{args[:exec]}' on #{host}"
21
21
  end
22
22
 
23
23
  def upload(filename, args = {})
@@ -30,6 +30,6 @@ module CheckDSL
30
30
  "and #{values.join(",")}"
31
31
  end
32
32
  @stats[:uploads] << filename
33
- Logger.info " upload '#{filename}' to #{host} #{custom}"
33
+ Logger.puts " upload '#{filename}' to #{host} #{custom}"
34
34
  end
35
35
  end
@@ -15,14 +15,14 @@ class ShowCheck
15
15
  output = {"global" => nil, "cases" => [{}]}
16
16
  script_vars = find_script_vars
17
17
  script_vars.each { |i| output["cases"][0][i.to_s] = "TOCHANGE" }
18
- Logger.info YAML.dump(output)
18
+ Logger.puts YAML.dump(output)
19
19
  end
20
20
 
21
21
  def revise_config_content
22
22
  unless File.exist?(@path[:config])
23
- Logger.warn "[WARN] Configfile not found"
24
- Logger.debug " #{@path[:config]}"
25
- Logger.warn "[INFO] Recomended content:"
23
+ Logger.warn "Configfile not found"
24
+ Logger.debug "- File: #{@path[:config]}"
25
+ Logger.info "Recomended content:"
26
26
  suggest_config_content
27
27
  return
28
28
  end
@@ -52,50 +52,44 @@ class ShowCheck
52
52
  end
53
53
 
54
54
  def show_stats
55
- my_screen_table = Terminal::Table.new do |st|
56
- st.add_row ["DSL Stats", "Count"]
57
- st.add_separator
55
+ table = Terminal::Table.new do |t|
56
+ t.style = {border: :unicode}
57
+ t.add_row ["DSL Stats", "Count"]
58
+ t.add_separator
58
59
 
59
- if Project.value[:uses].size.positive?
60
- st.add_row ["Uses", Project.value[:uses].size]
61
- end
60
+ t.add_row ["Uses", Project.value[:uses].size] if Project.value[:uses].size.positive?
62
61
  if Project.value[:macros].size.positive?
63
- st.add_row ["Macros", Project.value[:macros].size]
64
- Project.value[:macros].each_key { |value| st.add_row ["", value] }
65
- end
66
- st.add_row ["Groups", @stats[:groups]]
67
- st.add_row ["Targets", @stats[:targets]]
68
- runs = @stats[:hosts].values.inject(0) { |acc, item| acc + item }
69
- st.add_row ["Runs", runs]
70
- @stats[:hosts].each_pair { |k, v| st.add_row [" * #{k}", v] }
71
- if @stats[:uniques].positive?
72
- st.add_row ["Uniques", @stats[:uniques]]
73
- end
74
- if @stats[:logs].positive?
75
- st.add_row ["Logs", @stats[:logs]]
76
- end
77
- if @stats[:readmes].positive?
78
- st.add_row ["Readmes", @stats[:readmes]]
62
+ t.add_row ["Macros", Project.value[:macros].size]
63
+ Project.value[:macros].each_key { |value| t.add_row ["", value] }
79
64
  end
65
+ t.add_row ["Groups", @stats[:groups]]
66
+ t.add_row ["Targets", @stats[:targets]]
67
+ t.add_row ["Events", @stats[:events]] if @stats[:events].positive?
68
+ runs = @stats[:hosts].values.sum
69
+ t.add_row ["Runs", runs]
70
+ @stats[:hosts].each_pair { |k, v| t.add_row [" * #{k}", v] }
71
+ t.add_row ["Uniques", @stats[:uniques]] if @stats[:uniques].positive?
72
+ t.add_row ["Logs", @stats[:logs]] if @stats[:logs].positive?
73
+ t.add_row ["Readmes", @stats[:readmes]] if @stats[:readmes].positive?
80
74
 
81
75
  if @stats[:gets].size.positive?
82
- total = @stats[:gets].values.inject(0) { |acc, value| acc + value }
83
- st.add_row ["Gets", total]
76
+ total = @stats[:gets].values.sum
77
+ t.add_row ["Gets", total]
84
78
  list = @stats[:gets].sort_by { |_k, v| v }
85
- list.reverse_each { |item| st.add_row [" * #{item[0]}", item[1].to_s] }
79
+ list.reverse_each { |item| t.add_row [" * #{item[0]}", item[1].to_s] }
86
80
  end
87
81
 
88
82
  if @stats[:sets].size.positive?
89
- st.add_row ["Sets", @stats[:sets].size]
90
- @stats[:sets].each { |value| st.add_row ["", value] }
83
+ t.add_row ["Sets", @stats[:sets].size]
84
+ @stats[:sets].each { |value| t.add_row ["", value] }
91
85
  end
92
86
  if @stats[:uploads].size.positive?
93
- st.add_row ["Uploads", @stats[:uploads].size]
87
+ t.add_row ["Uploads", @stats[:uploads].size]
94
88
  uploads = @stats[:uploads].select { _1 }
95
- uploads.each { |value| st.add_row ["", value] }
89
+ uploads.each { |value| t.add_row ["", value] }
96
90
  end
97
91
  end
98
- Logger.info my_screen_table.to_s + "\n"
92
+ Logger.puts "#{table}\n"
99
93
  end
100
94
 
101
95
  private
@@ -40,7 +40,7 @@ module Teuton
40
40
  end
41
41
 
42
42
  map ["co", "-co", "--config"] => "config"
43
- desc "config [OPTIONS] DIRECTORY", "Suggest configuration."
43
+ desc "config DIRECTORY", "Suggest configuration."
44
44
  long_desc <<~LONGDESC
45
45
  config DIRECTORY, "Suggest the content of the configuration file based on the test"
46
46
  LONGDESC
@@ -22,7 +22,16 @@ module ReadmeDSL
22
22
  weight = args[:weight].to_f if args[:weight]
23
23
  @action.weight = weight
24
24
  end
25
- alias_method :goal, :target
25
+
26
+ def goal(...)
27
+ Logger.warn("Keyword deprecated: Replace 'goal' by 'target'.")
28
+ target(...)
29
+ end
30
+
31
+ def event(*args, &block)
32
+ # TODO
33
+ # args = on: XXX, when: XXX
34
+ end
26
35
 
27
36
  def unique(_key, _value)
28
37
  # Nothing to do
@@ -20,7 +20,7 @@ def group(name, &block)
20
20
  end
21
21
 
22
22
  def task(...)
23
- Logger.warn "[DEPRECATED] Replace 'task' by 'group'"
23
+ Logger.warn "Keyword deprecated: Replace 'task' by 'group'"
24
24
  group(...)
25
25
  end
26
26
 
@@ -29,6 +29,6 @@ def play(&block)
29
29
  end
30
30
 
31
31
  def start(...)
32
- Logger.warn "[DEPRECATED] Replace `start' by' play'"
32
+ Logger.warn "Keyword deprecated: Replace `start' by' play'"
33
33
  play(...)
34
34
  end