teuton 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/docs/changelog/todo.md +4 -8
  3. data/docs/changelog/v2.7.md +11 -0
  4. data/docs/diagram.md +16 -15
  5. data/docs/learn/06-cmd_check.md +3 -2
  6. data/docs/learn/21-exit_codes.md +9 -16
  7. data/lib/teuton/case/case.rb +25 -44
  8. data/lib/teuton/case/close.rb +2 -0
  9. data/lib/teuton/case/config.rb +3 -3
  10. data/lib/teuton/case/{runner.rb → deprecated/runner.rb} +14 -10
  11. data/lib/teuton/case/deprecated/utils.rb +40 -0
  12. data/lib/teuton/case/dsl/all.rb +8 -0
  13. data/lib/teuton/case/dsl/expect.rb +25 -9
  14. data/lib/teuton/case/dsl/goto.rb +10 -9
  15. data/lib/teuton/case/dsl/log.rb +1 -2
  16. data/lib/teuton/case/dsl/macro.rb +2 -2
  17. data/lib/teuton/case/dsl/send.rb +3 -8
  18. data/lib/teuton/case/execute/execute_base.rb +55 -0
  19. data/lib/teuton/case/execute/execute_local.rb +29 -0
  20. data/lib/teuton/case/execute/execute_manager.rb +56 -0
  21. data/lib/teuton/case/execute/execute_ssh.rb +90 -0
  22. data/lib/teuton/case/execute/execute_telnet.rb +56 -0
  23. data/lib/teuton/case/play.rb +6 -6
  24. data/lib/teuton/case_manager/case_manager.rb +12 -8
  25. data/lib/teuton/case_manager/check_cases.rb +14 -12
  26. data/lib/teuton/case_manager/dsl.rb +6 -8
  27. data/lib/teuton/case_manager/export_manager.rb +2 -3
  28. data/lib/teuton/case_manager/hall_of_fame.rb +9 -10
  29. data/lib/teuton/case_manager/report.rb +11 -9
  30. data/lib/teuton/case_manager/show_report.rb +4 -6
  31. data/lib/teuton/case_manager/utils.rb +2 -48
  32. data/lib/teuton/check/dsl.rb +1 -2
  33. data/lib/teuton/check/laboratory.rb +7 -7
  34. data/lib/teuton/check/show.rb +5 -8
  35. data/lib/teuton/cli.rb +10 -0
  36. data/lib/teuton/readme/dsl.rb +5 -7
  37. data/lib/teuton/readme/lang.rb +3 -2
  38. data/lib/teuton/readme/readme.rb +15 -18
  39. data/lib/teuton/report/formatter/default/array.rb +6 -5
  40. data/lib/teuton/report/formatter/default/txt.rb +1 -0
  41. data/lib/teuton/report/formatter/resume/array.rb +3 -3
  42. data/lib/teuton/report/formatter/resume/html.rb +2 -2
  43. data/lib/teuton/report/report.rb +6 -5
  44. data/lib/teuton/skeleton.rb +8 -10
  45. data/lib/teuton/{application.rb → utils/application.rb} +13 -5
  46. data/lib/teuton/utils/name_file_finder.rb +40 -45
  47. data/lib/teuton/utils/project.rb +73 -0
  48. data/lib/teuton/{result → utils/result}/result.rb +9 -7
  49. data/lib/teuton/utils/settings.rb +12 -0
  50. data/lib/teuton/utils/verbose.rb +2 -2
  51. data/lib/teuton/version.rb +1 -1
  52. data/lib/teuton.rb +18 -17
  53. metadata +19 -9
  54. data/lib/teuton/case/dsl.rb +0 -10
  55. /data/lib/teuton/{result → utils/result}/ext_array.rb +0 -0
  56. /data/lib/teuton/{result → utils/result}/ext_compare.rb +0 -0
  57. /data/lib/teuton/{result → utils/result}/ext_filter.rb +0 -0
@@ -15,14 +15,19 @@ require_relative "ext_filter"
15
15
  # * value
16
16
  class Result
17
17
  attr_reader :content
18
- attr_accessor :exitstatus
18
+ attr_accessor :exitcode
19
+ attr_writer :alterations
19
20
 
20
21
  def initialize
21
22
  reset
22
23
  end
23
24
 
24
25
  def alterations
25
- @alterations.join(" & ")
26
+ if @alterations.is_a? String
27
+ @alterations
28
+ else
29
+ @alterations.join(" & ")
30
+ end
26
31
  end
27
32
 
28
33
  def content=(content)
@@ -47,17 +52,14 @@ class Result
47
52
  def reset
48
53
  @content_backup = []
49
54
  @content = []
50
- @exitstatus = nil
55
+ @exitcode = -1
51
56
  @value = nil
52
57
  @expected = nil
53
58
  @alterations = []
54
59
  end
55
60
 
56
61
  def ok?
57
- # REVISE THIS
58
- return false if @exitstatus.nil?
59
-
60
- @exitstatus.zero?
62
+ @exitcode.zero?
61
63
  end
62
64
 
63
65
  def restore
@@ -0,0 +1,12 @@
1
+ class Settings
2
+ def self.letter
3
+ {
4
+ good: ".",
5
+ bad: "F",
6
+ error: "?",
7
+ none: " ",
8
+ ok: "\u{2714}",
9
+ cross: "\u{2716}"
10
+ }
11
+ end
12
+ end
@@ -1,4 +1,4 @@
1
- require_relative "../application"
1
+ require_relative "project"
2
2
 
3
3
  module Verbose
4
4
  def verboseln(text)
@@ -6,7 +6,7 @@ module Verbose
6
6
  end
7
7
 
8
8
  def verbose(text)
9
- return if Application.instance.quiet?
9
+ return if Project.quiet?
10
10
 
11
11
  print text
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.0"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
data/lib/teuton.rb CHANGED
@@ -1,18 +1,19 @@
1
- require_relative "teuton/application"
1
+ require_relative "teuton/utils/project"
2
2
 
3
3
  module Teuton
4
4
  def self.create(path_to_new_dir)
5
5
  require_relative "teuton/skeleton"
6
- Skeleton.create(path_to_new_dir)
6
+ Skeleton.new.create(path_to_new_dir)
7
7
  end
8
8
 
9
9
  def self.check(projectpath, options = {})
10
- Application.instance.add_input_params(projectpath, options)
10
+ Project.add_input_params(projectpath, options)
11
11
  require_dsl_and_script("teuton/check/laboratory") # Define DSL
12
-
13
- app = Application.instance
14
- lab = Laboratory.new(app.script_path, app.config_path)
15
- if options[:onlyconfig]
12
+ lab = Laboratory.new(
13
+ Project.value[:script_path],
14
+ Project.value[:config_path]
15
+ )
16
+ if options["onlyconfig"]
16
17
  lab.show_onlyconfig
17
18
  else
18
19
  lab.show
@@ -20,28 +21,28 @@ module Teuton
20
21
  end
21
22
 
22
23
  def self.run(projectpath, options = {})
23
- Application.instance.add_input_params(projectpath, options)
24
+ # Application.instance.add_input_params(projectpath, options)
25
+ Project.add_input_params(projectpath, options)
24
26
  require_dsl_and_script("teuton/case_manager/dsl") # Define DSL
25
27
  end
26
28
 
27
29
  def self.readme(projectpath, options = {})
28
- # Create Readme file for a teuton test
29
- Application.instance.add_input_params(projectpath, options)
30
+ Project.add_input_params(projectpath, options)
30
31
  require_dsl_and_script("teuton/readme/readme") # Define DSL
31
-
32
- app = Application.instance
33
- readme = Readme.new(app.script_path, app.config_path)
32
+ readme = Readme.new(
33
+ Project.value[:script_path],
34
+ Project.value[:config_path]
35
+ )
34
36
  readme.show
35
37
  end
36
38
 
37
39
  private_class_method def self.require_dsl_and_script(dslpath)
38
- app = Application.instance
39
40
  require_relative dslpath
40
41
  begin
41
- require_relative app.script_path
42
- rescue
42
+ require_relative Project.value[:script_path]
43
+ rescue => e
43
44
  warn e.to_s
44
- warn Rainbow.new("[FAIL ] Reading file #{app.script_path}").red
45
+ warn Rainbow.new("[FAIL ] Reading file #{Project.value[:script_path]}").red
45
46
  warn Rainbow.new("[ERROR] Syntax Error!").red
46
47
  exit 1
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -133,6 +133,7 @@ extra_rdoc_files:
133
133
  - docs/changelog/v2.4.md
134
134
  - docs/changelog/v2.5.md
135
135
  - docs/changelog/v2.6.md
136
+ - docs/changelog/v2.7.md
136
137
  - docs/changelog/version2.1.md
137
138
  - docs/commands/README.md
138
139
  - docs/commands/example_check.md
@@ -202,6 +203,7 @@ files:
202
203
  - docs/changelog/v2.4.md
203
204
  - docs/changelog/v2.5.md
204
205
  - docs/changelog/v2.6.md
206
+ - docs/changelog/v2.7.md
205
207
  - docs/changelog/version2.1.md
206
208
  - docs/commands/README.md
207
209
  - docs/commands/example_check.md
@@ -259,7 +261,6 @@ files:
259
261
  - docs/learn/videos.md
260
262
  - docs/videos.md
261
263
  - lib/teuton.rb
262
- - lib/teuton/application.rb
263
264
  - lib/teuton/case/builtin/main.rb
264
265
  - lib/teuton/case/builtin/package.rb
265
266
  - lib/teuton/case/builtin/service.rb
@@ -269,7 +270,9 @@ files:
269
270
  - lib/teuton/case/case.rb
270
271
  - lib/teuton/case/close.rb
271
272
  - lib/teuton/case/config.rb
272
- - lib/teuton/case/dsl.rb
273
+ - lib/teuton/case/deprecated/runner.rb
274
+ - lib/teuton/case/deprecated/utils.rb
275
+ - lib/teuton/case/dsl/all.rb
273
276
  - lib/teuton/case/dsl/expect.rb
274
277
  - lib/teuton/case/dsl/getset.rb
275
278
  - lib/teuton/case/dsl/goto.rb
@@ -278,8 +281,12 @@ files:
278
281
  - lib/teuton/case/dsl/send.rb
279
282
  - lib/teuton/case/dsl/target.rb
280
283
  - lib/teuton/case/dsl/unique.rb
284
+ - lib/teuton/case/execute/execute_base.rb
285
+ - lib/teuton/case/execute/execute_local.rb
286
+ - lib/teuton/case/execute/execute_manager.rb
287
+ - lib/teuton/case/execute/execute_ssh.rb
288
+ - lib/teuton/case/execute/execute_telnet.rb
281
289
  - lib/teuton/case/play.rb
282
- - lib/teuton/case/runner.rb
283
290
  - lib/teuton/case_manager/case_manager.rb
284
291
  - lib/teuton/case_manager/check_cases.rb
285
292
  - lib/teuton/case_manager/dsl.rb
@@ -319,13 +326,16 @@ files:
319
326
  - lib/teuton/report/formatter/resume/txt.rb
320
327
  - lib/teuton/report/formatter/resume/yaml.rb
321
328
  - lib/teuton/report/report.rb
322
- - lib/teuton/result/ext_array.rb
323
- - lib/teuton/result/ext_compare.rb
324
- - lib/teuton/result/ext_filter.rb
325
- - lib/teuton/result/result.rb
326
329
  - lib/teuton/skeleton.rb
330
+ - lib/teuton/utils/application.rb
327
331
  - lib/teuton/utils/configfile_reader.rb
328
332
  - lib/teuton/utils/name_file_finder.rb
333
+ - lib/teuton/utils/project.rb
334
+ - lib/teuton/utils/result/ext_array.rb
335
+ - lib/teuton/utils/result/ext_compare.rb
336
+ - lib/teuton/utils/result/ext_filter.rb
337
+ - lib/teuton/utils/result/result.rb
338
+ - lib/teuton/utils/settings.rb
329
339
  - lib/teuton/utils/verbose.rb
330
340
  - lib/teuton/version.rb
331
341
  homepage: https://github.com/teuton-software/teuton
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "dsl/expect"
4
- require_relative "dsl/getset"
5
- require_relative "dsl/goto"
6
- require_relative "dsl/log"
7
- require_relative "dsl/macro"
8
- require_relative "dsl/send"
9
- require_relative "dsl/target"
10
- require_relative "dsl/unique"
File without changes
File without changes
File without changes