teuton 3.3.0 → 3.4.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -14
  3. data/docs/commands/README.md +5 -4
  4. data/docs/commands/{readme.md → doc.md} +3 -5
  5. data/docs/commands/help.md +8 -8
  6. data/docs/devel/todo.md +1 -4
  7. data/docs/dsl/README.md +9 -8
  8. data/docs/dsl/event.md +172 -0
  9. data/docs/learn/01-cmd_new.md +1 -1
  10. data/docs/learn/02-target.md +18 -18
  11. data/docs/learn/03-remote_hosts.md +1 -1
  12. data/docs/learn/04-config.md +15 -13
  13. data/docs/learn/05-use.md +1 -1
  14. data/docs/learn/06-cmd_check.md +2 -2
  15. data/docs/learn/07-target_weight.md +4 -2
  16. data/docs/learn/08-unique_values.md +1 -1
  17. data/docs/learn/09-send.md +2 -2
  18. data/docs/learn/10-debug.md +10 -9
  19. data/docs/learn/11-export.md +1 -1
  20. data/docs/learn/12-preserve.md +4 -4
  21. data/docs/learn/13-feedback.md +3 -3
  22. data/docs/learn/14-moodle_id.md +3 -3
  23. data/docs/learn/15-readme.md +10 -10
  24. data/docs/learn/16-include.md +3 -3
  25. data/docs/learn/17-alias.md +2 -2
  26. data/docs/learn/18-log.md +3 -2
  27. data/docs/learn/19-read_vars.md +1 -1
  28. data/docs/learn/20-macros.md +1 -1
  29. data/docs/learn/21-exit_codes.md +1 -1
  30. data/docs/learn/22-result.md +1 -1
  31. data/docs/learn/23-test-code.md +1 -1
  32. data/docs/learn/24-test-sql.md +1 -1
  33. data/docs/learn/25-expect-result.md +1 -1
  34. data/docs/learn/26-expect_sequence.md +1 -1
  35. data/docs/learn/27-run_script.md +1 -1
  36. data/docs/learn/28-upload.md +3 -1
  37. data/docs/learn/31-event-stop.md +134 -0
  38. data/docs/learn/32-event-zero.md +127 -0
  39. data/docs/more.md +4 -1
  40. data/lib/teuton/case/action/manager.rb +146 -11
  41. data/lib/teuton/case/case.rb +2 -0
  42. data/lib/teuton/case/close.rb +4 -4
  43. data/lib/teuton/case/dsl/event.rb +1 -20
  44. data/lib/teuton/case/dsl/expect.rb +1 -1
  45. data/lib/teuton/case/dsl/log.rb +8 -3
  46. data/lib/teuton/case/dsl/target.rb +6 -1
  47. data/lib/teuton/case_manager/show_resume_report.rb +2 -2
  48. data/lib/teuton/check/checker.rb +2 -0
  49. data/lib/teuton/check/dsl/all.rb +8 -22
  50. data/lib/teuton/check/dsl/event.rb +10 -0
  51. data/lib/teuton/check/dsl/expect.rb +8 -16
  52. data/lib/teuton/check/dsl/target.rb +17 -0
  53. data/lib/teuton/check/show.rb +12 -12
  54. data/lib/teuton/cli/app.rb +15 -7
  55. data/lib/teuton/readme/dsl/all.rb +6 -1
  56. data/lib/teuton/report/formatter/default/txt.rb +9 -8
  57. data/lib/teuton/report/formatter/resume/txt.rb +5 -5
  58. data/lib/teuton/report/report.rb +2 -35
  59. data/lib/teuton/version.rb +1 -1
  60. metadata +11 -3
@@ -23,30 +23,30 @@ class TXTFormatter < ArrayFormatter
23
23
  private
24
24
 
25
25
  def process_config
26
- w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
26
+ w "#{colorize(" \u{2692} CONFIGURATION", :bg_blue)}\n"
27
27
  table = Terminal::Table.new do |t|
28
28
  t.style = {border: :unicode}
29
29
  @data[:config].sort.each { |key, value| t.add_row [key.to_s, value.to_s] }
30
30
  end
31
- w "#{table}\n\n"
31
+ w "#{table}\n"
32
32
  end
33
33
 
34
34
  def process_logs
35
35
  return if @data[:logs].empty?
36
36
 
37
- w "#{colorize(" LOGS", :bg_blue)}\n"
37
+ w "#{colorize("\n \u{1f6c8} LOGS", :bg_blue)}\n"
38
38
  @data[:logs].each { |line| w " #{line}\n" }
39
39
  end
40
40
 
41
41
  def process_groups
42
42
  return if @data[:groups].empty?
43
43
 
44
- w "\n#{colorize(" GROUPS", :bg_blue)}\n"
44
+ w "\n#{colorize(" \u{2630} GROUPS", :bg_blue)}\n"
45
45
  @data[:groups].each { |g| process_group g }
46
46
  end
47
47
 
48
48
  def process_results
49
- w "\n#{colorize(" RESULTS", :bg_blue)}\n"
49
+ w "\n#{colorize(" \u{1f5f9} RESULTS", :bg_blue)}\n"
50
50
  table = Terminal::Table.new do |t|
51
51
  t.style = {border: :unicode}
52
52
  @data[:results].each { |key, value| t.add_row [key.to_s, value.to_s] }
@@ -57,7 +57,7 @@ class TXTFormatter < ArrayFormatter
57
57
  def process_hof
58
58
  return if @data[:hall_of_fame].empty?
59
59
 
60
- w "\n#{colorize(" HALL OF FAME", :bg_blue)}\n"
60
+ w "\n#{colorize(" \u{2605} HALL OF FAME", :bg_blue)}\n"
61
61
  my_screen_table = Terminal::Table.new do |t|
62
62
  t.style = {border: :unicode}
63
63
  @data[:hall_of_fame].each do |line|
@@ -96,7 +96,8 @@ class TXTFormatter < ArrayFormatter
96
96
  else
97
97
  "├──"
98
98
  end
99
- w " (#{colorize(text, color)}) #{corner}\n"
99
+ s = " " * (10 - text.size)
100
+ w " (#{colorize(text, color)})#{s}#{corner}\n"
100
101
  w "#{tab * 4}Description │ #{i[:description]}\n"
101
102
  w "#{tab * 4}Command │ #{i[:command]}\n"
102
103
  w "#{tab * 4}Output │ #{i[:output]}\n"
@@ -105,7 +106,7 @@ class TXTFormatter < ArrayFormatter
105
106
  w "#{tab * 4}Expected │ #{i[:expected]}\n"
106
107
  w "#{tab * 4}Result │ #{i[:result]}\n"
107
108
  end
108
- w "#{tab * 10}└──"
109
+ w "#{tab * 10}└──\n"
109
110
  end
110
111
 
111
112
  def colorize(text, option)
@@ -25,7 +25,7 @@ class ResumeTXTFormatter < ResumeArrayFormatter
25
25
  private
26
26
 
27
27
  def process_config
28
- w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
28
+ w "#{colorize(" \u{2692} CONFIGURATION ", :bg_blue)}\n"
29
29
  table = Terminal::Table.new do |t|
30
30
  t.style = {border: :unicode}
31
31
  @data[:config].each { |key, value| t.add_row [key.to_s, trim(value)] }
@@ -34,7 +34,7 @@ class ResumeTXTFormatter < ResumeArrayFormatter
34
34
  end
35
35
 
36
36
  def process_cases
37
- w "#{colorize(" CASES", :bg_blue)}\n"
37
+ w "#{colorize(" \u{2630} CASES", :bg_blue)}\n"
38
38
  table = Terminal::Table.new do |t|
39
39
  t.style = {border: :unicode}
40
40
  t.add_row %w[CASE MEMBERS GRADE STATE]
@@ -62,11 +62,11 @@ class ResumeTXTFormatter < ResumeArrayFormatter
62
62
  end
63
63
  return unless table.rows.size > 1
64
64
 
65
- w "#{colorize(" CONN ERRORS", :bg_blue)}\n#{table}\n\n"
65
+ w "#{colorize(" \u{1f5f2} CONN ERRORS", :bg_blue)}\n#{table}\n\n"
66
66
  end
67
67
 
68
68
  def process_results
69
- w "#{colorize(" RESULTS", :bg_blue)}\n"
69
+ w "#{colorize(" \u{1f5f9} RESULTS", :bg_blue)}\n"
70
70
  table = Terminal::Table.new do |t|
71
71
  t.style = {border: :unicode}
72
72
  @data[:results].each { |key, value| t.add_row([key.to_s, value.to_s]) }
@@ -77,7 +77,7 @@ class ResumeTXTFormatter < ResumeArrayFormatter
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"
80
+ w "#{colorize(' \u{2605} HALL OF FAME', :bg_blue)}\n"
81
81
  table = Terminal::Table.new do |t|
82
82
  t.style = {border: :unicode}
83
83
  @data[:hall_of_fame].each do |line|
@@ -3,8 +3,8 @@ require_relative "../utils/settings"
3
3
  require_relative "formatter/formatter"
4
4
 
5
5
  class Report
6
- attr_accessor :id, :filename, :output_dir, :head, :lines, :tail, :format
7
- attr_reader :history
6
+ attr_accessor :id, :filename, :output_dir,
7
+ :head, :lines, :tail, :format, :history
8
8
 
9
9
  def initialize(id = "00")
10
10
  @id = id
@@ -46,37 +46,4 @@ class Report
46
46
  filepath = File.join(@output_dir, "moodle")
47
47
  Formatter.call(self, {format: :moodle_csv}, filepath)
48
48
  end
49
-
50
- ##
51
- # Calculate final values:
52
- # * grade
53
- # * max_weight
54
- # * good_weight,d
55
- # * fail_weight
56
- # * fail_counter
57
- def close
58
- max = good = fails = fail_counter = 0
59
- @lines.each do |i|
60
- next unless i.instance_of? Hash
61
-
62
- max += i[:weight] if i[:weight].positive?
63
- if i[:check]
64
- good += i[:weight]
65
- @history += Settings.letter[:good]
66
- else
67
- fails += i[:weight]
68
- fail_counter += 1
69
- @history += Settings.letter[:fail]
70
- end
71
- end
72
- @tail[:max_weight] = max
73
- @tail[:good_weight] = good
74
- @tail[:fail_weight] = fails
75
- @tail[:fail_counter] = fail_counter
76
-
77
- i = good.to_f / max
78
- i = 0 if i.nan?
79
- @tail[:grade] = (100.0 * i).round
80
- @tail[:grade] = 0 if @tail[:unique_fault].positive?
81
- end
82
49
  end
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "3.3.0".freeze
2
+ VERSION = "3.4.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.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
@@ -126,15 +126,16 @@ extra_rdoc_files:
126
126
  - docs/commands/README.md
127
127
  - docs/commands/check.md
128
128
  - docs/commands/config.md
129
+ - docs/commands/doc.md
129
130
  - docs/commands/help.md
130
131
  - docs/commands/new.md
131
- - docs/commands/readme.md
132
132
  - docs/commands/run.md
133
133
  - docs/config_file.md
134
134
  - docs/devel/contribute.md
135
135
  - docs/devel/diagram.md
136
136
  - docs/devel/todo.md
137
137
  - docs/dsl/README.md
138
+ - docs/dsl/event.md
138
139
  - docs/dsl/expect.md
139
140
  - docs/dsl/export.md
140
141
  - docs/dsl/get.md
@@ -181,6 +182,8 @@ extra_rdoc_files:
181
182
  - docs/learn/26-expect_sequence.md
182
183
  - docs/learn/27-run_script.md
183
184
  - docs/learn/28-upload.md
185
+ - docs/learn/31-event-stop.md
186
+ - docs/learn/32-event-zero.md
184
187
  - docs/learn/README.md
185
188
  - docs/modes_of_use.md
186
189
  - docs/more.md
@@ -191,15 +194,16 @@ files:
191
194
  - docs/commands/README.md
192
195
  - docs/commands/check.md
193
196
  - docs/commands/config.md
197
+ - docs/commands/doc.md
194
198
  - docs/commands/help.md
195
199
  - docs/commands/new.md
196
- - docs/commands/readme.md
197
200
  - docs/commands/run.md
198
201
  - docs/config_file.md
199
202
  - docs/devel/contribute.md
200
203
  - docs/devel/diagram.md
201
204
  - docs/devel/todo.md
202
205
  - docs/dsl/README.md
206
+ - docs/dsl/event.md
203
207
  - docs/dsl/expect.md
204
208
  - docs/dsl/export.md
205
209
  - docs/dsl/get.md
@@ -246,6 +250,8 @@ files:
246
250
  - docs/learn/26-expect_sequence.md
247
251
  - docs/learn/27-run_script.md
248
252
  - docs/learn/28-upload.md
253
+ - docs/learn/31-event-stop.md
254
+ - docs/learn/32-event-zero.md
249
255
  - docs/learn/README.md
250
256
  - docs/modes_of_use.md
251
257
  - docs/more.md
@@ -300,10 +306,12 @@ files:
300
306
  - lib/teuton/check/checker.rb
301
307
  - lib/teuton/check/dsl/all.rb
302
308
  - lib/teuton/check/dsl/builtin.rb
309
+ - lib/teuton/check/dsl/event.rb
303
310
  - lib/teuton/check/dsl/expect.rb
304
311
  - lib/teuton/check/dsl/expect_sequence.rb
305
312
  - lib/teuton/check/dsl/getset.rb
306
313
  - lib/teuton/check/dsl/run.rb
314
+ - lib/teuton/check/dsl/target.rb
307
315
  - lib/teuton/check/main.rb
308
316
  - lib/teuton/check/show.rb
309
317
  - lib/teuton/cli/app.rb