teuton 2.5.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/docs/CHANGELOG.md +2 -0
  3. data/docs/changelog/todo.md +4 -6
  4. data/docs/changelog/v2.6.md +4 -0
  5. data/docs/changelog/v2.7.md +11 -0
  6. data/docs/diagram.md +55 -0
  7. data/docs/learn/02-target.md +37 -12
  8. data/docs/learn/03-remote_hosts.md +1 -1
  9. data/docs/learn/04-config.md +1 -1
  10. data/docs/learn/06-cmd_check.md +4 -6
  11. data/docs/learn/07-target_weight.md +1 -3
  12. data/docs/learn/21-exit_codes.md +9 -16
  13. data/docs/learn/README.md +1 -1
  14. data/lib/teuton/case/case.rb +95 -0
  15. data/lib/teuton/{case_manager/case → case}/close.rb +2 -0
  16. data/lib/teuton/{case_manager/case → case}/config.rb +3 -3
  17. data/lib/teuton/{case_manager/case → case/deprecated}/runner.rb +14 -10
  18. data/lib/teuton/case/deprecated/utils.rb +40 -0
  19. data/lib/teuton/{case_manager/case/dsl/main.rb → case/dsl/all.rb} +0 -2
  20. data/lib/teuton/{case_manager/case → case}/dsl/expect.rb +25 -9
  21. data/lib/teuton/{case_manager/case → case}/dsl/goto.rb +10 -9
  22. data/lib/teuton/{case_manager/case → case}/dsl/log.rb +1 -2
  23. data/lib/teuton/{case_manager/case → case}/dsl/macro.rb +2 -2
  24. data/lib/teuton/{case_manager/case → case}/dsl/send.rb +3 -8
  25. data/lib/teuton/case/execute/execute_base.rb +55 -0
  26. data/lib/teuton/case/execute/execute_local.rb +29 -0
  27. data/lib/teuton/case/execute/execute_manager.rb +56 -0
  28. data/lib/teuton/case/execute/execute_ssh.rb +90 -0
  29. data/lib/teuton/case/execute/execute_telnet.rb +56 -0
  30. data/lib/teuton/{case_manager/case → case}/play.rb +11 -14
  31. data/lib/teuton/case_manager/case_manager.rb +20 -39
  32. data/lib/teuton/case_manager/check_cases.rb +14 -12
  33. data/lib/teuton/case_manager/dsl.rb +7 -9
  34. data/lib/teuton/case_manager/export_manager.rb +19 -6
  35. data/lib/teuton/case_manager/hall_of_fame.rb +9 -10
  36. data/lib/teuton/case_manager/report.rb +11 -9
  37. data/lib/teuton/case_manager/send_manager.rb +17 -0
  38. data/lib/teuton/{report/show.rb → case_manager/show_report.rb} +4 -6
  39. data/lib/teuton/case_manager/utils.rb +2 -43
  40. data/lib/teuton/check/dsl.rb +1 -2
  41. data/lib/teuton/check/laboratory.rb +7 -7
  42. data/lib/teuton/check/show.rb +5 -8
  43. data/lib/teuton/cli.rb +10 -0
  44. data/lib/teuton/readme/dsl.rb +5 -7
  45. data/lib/teuton/readme/lang.rb +3 -2
  46. data/lib/teuton/readme/readme.rb +15 -18
  47. data/lib/teuton/report/formatter/default/array.rb +6 -5
  48. data/lib/teuton/report/formatter/default/txt.rb +1 -0
  49. data/lib/teuton/report/formatter/resume/array.rb +3 -3
  50. data/lib/teuton/report/formatter/resume/html.rb +2 -2
  51. data/lib/teuton/report/report.rb +6 -5
  52. data/lib/teuton/skeleton.rb +8 -10
  53. data/lib/teuton/{application.rb → utils/application.rb} +13 -5
  54. data/lib/teuton/utils/name_file_finder.rb +40 -45
  55. data/lib/teuton/utils/project.rb +73 -0
  56. data/lib/teuton/{case_manager/case → utils}/result/ext_array.rb +5 -5
  57. data/lib/teuton/{case_manager/case → utils}/result/result.rb +10 -8
  58. data/lib/teuton/utils/settings.rb +12 -0
  59. data/lib/teuton/utils/verbose.rb +2 -2
  60. data/lib/teuton/version.rb +1 -1
  61. data/lib/teuton.rb +28 -27
  62. metadata +43 -30
  63. data/lib/teuton/case_manager/case/case.rb +0 -117
  64. data/lib/teuton/case_manager/case/main.rb +0 -7
  65. data/lib/teuton/case_manager/main.rb +0 -3
  66. /data/lib/teuton/{case_manager/case → case}/builtin/main.rb +0 -0
  67. /data/lib/teuton/{case_manager/case → case}/builtin/package.rb +0 -0
  68. /data/lib/teuton/{case_manager/case → case}/builtin/service.rb +0 -0
  69. /data/lib/teuton/{case_manager/case → case}/builtin/teuton_file.rb +0 -0
  70. /data/lib/teuton/{case_manager/case → case}/builtin/teuton_host.rb +0 -0
  71. /data/lib/teuton/{case_manager/case → case}/builtin/user.rb +0 -0
  72. /data/lib/teuton/{case_manager/case → case}/dsl/getset.rb +0 -0
  73. /data/lib/teuton/{case_manager/case → case}/dsl/target.rb +0 -0
  74. /data/lib/teuton/{case_manager/case → case}/dsl/unique.rb +0 -0
  75. /data/lib/teuton/{case_manager/case → utils}/result/ext_compare.rb +0 -0
  76. /data/lib/teuton/{case_manager/case → utils}/result/ext_filter.rb +0 -0
@@ -1,5 +1,5 @@
1
1
  require "singleton"
2
- require_relative "utils/name_file_finder"
2
+ require_relative "name_file_finder"
3
3
 
4
4
  class Application
5
5
  include Singleton
@@ -33,7 +33,11 @@ class Application
33
33
  @running_basedir = Dir.getwd
34
34
  @output_basedir = "var"
35
35
  @default = {name: "teuton", format: :txt, debug: false}
36
- @options = {"lang" => "en"}
36
+ @options = {
37
+ "lang" => "en",
38
+ "color" => true,
39
+ "panel" => false
40
+ }
37
41
  @verbose = true
38
42
 
39
43
  @global = {}
@@ -65,10 +69,14 @@ class Application
65
69
  # * Read color input option
66
70
  def add_input_params(projectpath, options)
67
71
  @options.merge! options
68
- NameFileFinder.find_filenames_for(projectpath)
69
- @options["color"] = true if @options["color"].nil?
70
72
  Rainbow.enabled = @options["color"]
71
- @options["panel"] = false if @options["panel"].nil?
73
+
74
+ finder = NameFileFinder.new(@options)
75
+ finder.find_filenames_for(projectpath)
76
+ @project_path = finder.project_path
77
+ @script_path = finder.script_path
78
+ @config_path = finder.config_path
79
+ @test_name = finder.test_name
72
80
 
73
81
  unless @options["case"].nil?
74
82
  numbers = @options["case"].split(",")
@@ -1,10 +1,24 @@
1
1
  require "rainbow"
2
2
 
3
- module NameFileFinder
3
+ class NameFileFinder
4
+ attr_reader :options
5
+ attr_reader :project_path
6
+ attr_reader :script_path
7
+ attr_reader :config_path
8
+ attr_reader :test_name
9
+
10
+ def initialize(options = {})
11
+ @options = options
12
+ @project_path = nil
13
+ @script_path = nil
14
+ @config_path = nil
15
+ @test_name = nil
16
+ end
17
+
4
18
  ##
5
19
  # Find project filenames from input project relative path
6
20
  # @param relprojectpath (String)
7
- def self.find_filenames_for(relprojectpath)
21
+ def find_filenames_for(relprojectpath)
8
22
  projectpath = File.absolute_path(relprojectpath)
9
23
 
10
24
  # Define:
@@ -20,10 +34,10 @@ module NameFileFinder
20
34
  true
21
35
  end
22
36
 
23
- ##
24
- # Find project filenames from input folder path
25
- # @param folder_path (String)
26
- def self.find_filenames_from_directory(folder_path)
37
+ private
38
+
39
+ def find_filenames_from_directory(folder_path)
40
+ # Find project filenames from input folder path
27
41
  # COMPLEX MODE: We use start.rb as main RB file
28
42
  script_path = File.join(folder_path, "start.rb")
29
43
  unless File.exist? script_path
@@ -31,38 +45,34 @@ module NameFileFinder
31
45
  exit 1
32
46
  end
33
47
 
34
- app = Application.instance
35
- app.project_path = folder_path
36
- app.script_path = script_path
37
- app.test_name = folder_path.split(File::SEPARATOR)[-1]
48
+ @project_path = folder_path
49
+ @script_path = script_path
50
+ @test_name = folder_path.split(File::SEPARATOR)[-1]
38
51
 
39
52
  find_configfilename_from_directory(folder_path)
40
53
  end
41
54
 
42
- ##
43
- # Find project config filename from input folder path
44
- # @param folder_path (String)
45
- def self.find_configfilename_from_directory(folder_path)
55
+ def find_configfilename_from_directory(folder_path)
56
+ # Find project config filename from input folder path
46
57
  # COMPLEX MODE: We use config.yaml by default
47
- app = Application.instance
48
58
  config_path = ""
49
59
 
50
- if app.options["cpath"].nil?
60
+ if options["cpath"].nil?
51
61
  config_name = "config"
52
62
  # Config name file is introduced by cname arg option from teuton command
53
- config_name = app.options["cname"] unless app.options["cname"].nil?
63
+ config_name = options["cname"] unless options["cname"].nil?
54
64
  config_path = File.join(folder_path, "#{config_name}.json")
55
65
  unless File.exist? config_path
56
66
  config_path = File.join(folder_path, "#{config_name}.yaml")
57
67
  end
58
68
  else
59
69
  # Config path file is introduced by cpath arg option from teuton command
60
- config_path = app.options["cpath"]
70
+ config_path = options["cpath"]
61
71
  end
62
- app.config_path = config_path
72
+ @config_path = config_path
63
73
  end
64
74
 
65
- def self.find_filenames_from_rb(script_path)
75
+ def find_filenames_from_rb(script_path)
66
76
  # SIMPLE MODE: We use script_path as main RB file
67
77
  # This must be fullpath to DSL script file
68
78
  if File.extname(script_path) != ".rb"
@@ -71,44 +81,29 @@ module NameFileFinder
71
81
  exit 1
72
82
  end
73
83
 
74
- app = Application.instance
75
- app.project_path = File.dirname(script_path)
76
- app.script_path = script_path
77
- app.test_name = File.basename(script_path, ".rb")
78
-
84
+ @project_path = File.dirname(script_path)
85
+ @script_path = script_path
86
+ @test_name = File.basename(script_path, ".rb")
79
87
  find_configfilenames_from_rb(script_path)
80
88
  end
81
89
 
82
- def self.find_configfilenames_from_rb(script_path)
90
+ def find_configfilenames_from_rb(script_path)
83
91
  # SIMPLE MODE: We use script_path as main RB file
84
92
  # This must be fullpath to DSL script file
85
- app = Application.instance
86
-
87
93
  config_path = ""
88
- if app.options["cpath"].nil?
94
+ if options["cpath"].nil?
89
95
  config_name = File.basename(script_path, ".rb")
90
96
  # Config name file is introduced by cname arg option from teuton command
91
- config_name = app.options["cname"] unless app.options["cname"].nil?
97
+ config_name = options["cname"] unless options["cname"].nil?
92
98
 
93
- config_path = File.join(app.project_path, config_name + ".json")
99
+ config_path = File.join(@project_path, config_name + ".json")
94
100
  unless File.exist? config_path
95
- config_path = File.join(app.project_path, config_name + ".yaml")
101
+ config_path = File.join(@project_path, config_name + ".yaml")
96
102
  end
97
103
  else
98
104
  # Config path file is introduced by cpath arg option from teuton command
99
- config_path = app.options["cpath"]
105
+ config_path = options["cpath"]
100
106
  end
101
- app.config_path = config_path
102
- end
103
-
104
- def self.verboseln(text)
105
- verbose(text + "\n")
106
- end
107
-
108
- def self.verbose(text)
109
- return unless Application.instance.verbose
110
- return if Application.instance.options["quiet"]
111
-
112
- print text
107
+ @config_path = config_path
113
108
  end
114
109
  end
@@ -0,0 +1,73 @@
1
+ # Development in progress...
2
+
3
+ require_relative "name_file_finder"
4
+
5
+ class Project
6
+ def self.init
7
+ @project = {}
8
+ @project[:running_basedir] = Dir.getwd
9
+ @project[:output_basedir] = "var"
10
+ @project[:name] = "teuton"
11
+ @project[:format] = :txt
12
+ @project[:debug] = false
13
+ @project[:options] = {
14
+ "color" => true,
15
+ "lang" => "en",
16
+ "panel" => false,
17
+ "quiet" => false
18
+ }
19
+ @project[:verbose] = true
20
+ @project[:global] = {} # Hash of Global configuration params
21
+ @project[:ialias] = {} # Hash of Internal alias
22
+ @project[:macros] = {} # Hash of macros
23
+ @project[:groups] = [] # Array of groups
24
+ @project[:uses] = [] # TODO: Array of files used
25
+ @project[:hall_of_fame] = []
26
+ end
27
+
28
+ def self.value
29
+ @project
30
+ end
31
+
32
+ init
33
+
34
+ def self.debug?
35
+ value[:debug]
36
+ end
37
+
38
+ def self.name
39
+ value[:name]
40
+ end
41
+
42
+ def self.quiet?
43
+ return true if value[:options]["quiet"]
44
+ return true unless value[:verbose]
45
+
46
+ false
47
+ end
48
+
49
+ def self.verbose
50
+ value[:verbose]
51
+ end
52
+
53
+ ##
54
+ # Preprocess input options:
55
+ # * Convert input case options String to an Array of integers
56
+ # * Read color input option
57
+ def self.add_input_params(projectpath, options)
58
+ value[:options].merge! options
59
+ Rainbow.enabled = value[:options]["color"]
60
+
61
+ finder = NameFileFinder.new(value[:options])
62
+ finder.find_filenames_for(projectpath)
63
+ value[:project_path] = finder.project_path
64
+ value[:script_path] = finder.script_path
65
+ value[:config_path] = finder.config_path
66
+ value[:test_name] = finder.test_name
67
+
68
+ unless value[:options]["case"].nil?
69
+ numbers = value[:options]["case"].split(",")
70
+ value[:options]["case"] = numbers.collect!(&:to_i)
71
+ end
72
+ end
73
+ end
@@ -35,9 +35,9 @@ class Result
35
35
  @content.empty
36
36
  end
37
37
 
38
- alias count! count
39
- alias length count
40
- alias len count
41
- alias size count
42
- alias empty? empty
38
+ alias_method :count!, :count
39
+ alias_method :length, :count
40
+ alias_method :len, :count
41
+ alias_method :size, :count
42
+ alias_method :empty?, :empty
43
43
  end
@@ -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
@@ -66,7 +68,7 @@ class Result
66
68
  @content_backup = temp
67
69
  @content = temp.clone
68
70
  end
69
- alias restore! restore
71
+ alias_method :restore!, :restore
70
72
 
71
73
  def value
72
74
  @content[0]
@@ -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.5.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,47 +1,48 @@
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)
7
- end
8
-
9
- def self.run(projectpath, options = {})
10
- Application.instance.add_input_params(projectpath, options)
11
- require_dsl_and_script("teuton/case_manager/dsl") # Define DSL keywords
12
- end
13
-
14
- def self.readme(projectpath, options = {})
15
- # Create Readme file for a teuton test
16
- Application.instance.add_input_params(projectpath, options)
17
- require_dsl_and_script("teuton/readme/readme") # Define DSL keywords
18
-
19
- app = Application.instance
20
- readme = Readme.new(app.script_path, app.config_path)
21
- readme.show
6
+ Skeleton.new.create(path_to_new_dir)
22
7
  end
23
8
 
24
9
  def self.check(projectpath, options = {})
25
- Application.instance.add_input_params(projectpath, options)
26
- require_dsl_and_script("teuton/check/laboratory") # Define DSL keywords
27
-
28
- app = Application.instance
29
- lab = Laboratory.new(app.script_path, app.config_path)
30
- if options[:onlyconfig]
10
+ Project.add_input_params(projectpath, options)
11
+ require_dsl_and_script("teuton/check/laboratory") # Define DSL
12
+ lab = Laboratory.new(
13
+ Project.value[:script_path],
14
+ Project.value[:config_path]
15
+ )
16
+ if options["onlyconfig"]
31
17
  lab.show_onlyconfig
32
18
  else
33
19
  lab.show
34
20
  end
35
21
  end
36
22
 
23
+ def self.run(projectpath, options = {})
24
+ # Application.instance.add_input_params(projectpath, options)
25
+ Project.add_input_params(projectpath, options)
26
+ require_dsl_and_script("teuton/case_manager/dsl") # Define DSL
27
+ end
28
+
29
+ def self.readme(projectpath, options = {})
30
+ Project.add_input_params(projectpath, options)
31
+ require_dsl_and_script("teuton/readme/readme") # Define DSL
32
+ readme = Readme.new(
33
+ Project.value[:script_path],
34
+ Project.value[:config_path]
35
+ )
36
+ readme.show
37
+ end
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.5.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-05 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
@@ -132,10 +132,13 @@ extra_rdoc_files:
132
132
  - docs/changelog/v2.3.md
133
133
  - docs/changelog/v2.4.md
134
134
  - docs/changelog/v2.5.md
135
+ - docs/changelog/v2.6.md
136
+ - docs/changelog/v2.7.md
135
137
  - docs/changelog/version2.1.md
136
138
  - docs/commands/README.md
137
139
  - docs/commands/example_check.md
138
140
  - docs/commands/example_run.md
141
+ - docs/diagram.md
139
142
  - docs/dsl/README.md
140
143
  - docs/dsl/expect.md
141
144
  - docs/dsl/export.md
@@ -199,10 +202,13 @@ files:
199
202
  - docs/changelog/v2.3.md
200
203
  - docs/changelog/v2.4.md
201
204
  - docs/changelog/v2.5.md
205
+ - docs/changelog/v2.6.md
206
+ - docs/changelog/v2.7.md
202
207
  - docs/changelog/version2.1.md
203
208
  - docs/commands/README.md
204
209
  - docs/commands/example_check.md
205
210
  - docs/commands/example_run.md
211
+ - docs/diagram.md
206
212
  - docs/dsl/README.md
207
213
  - docs/dsl/expect.md
208
214
  - docs/dsl/export.md
@@ -255,39 +261,40 @@ files:
255
261
  - docs/learn/videos.md
256
262
  - docs/videos.md
257
263
  - lib/teuton.rb
258
- - lib/teuton/application.rb
259
- - lib/teuton/case_manager/case/builtin/main.rb
260
- - lib/teuton/case_manager/case/builtin/package.rb
261
- - lib/teuton/case_manager/case/builtin/service.rb
262
- - lib/teuton/case_manager/case/builtin/teuton_file.rb
263
- - lib/teuton/case_manager/case/builtin/teuton_host.rb
264
- - lib/teuton/case_manager/case/builtin/user.rb
265
- - lib/teuton/case_manager/case/case.rb
266
- - lib/teuton/case_manager/case/close.rb
267
- - lib/teuton/case_manager/case/config.rb
268
- - lib/teuton/case_manager/case/dsl/expect.rb
269
- - lib/teuton/case_manager/case/dsl/getset.rb
270
- - lib/teuton/case_manager/case/dsl/goto.rb
271
- - lib/teuton/case_manager/case/dsl/log.rb
272
- - lib/teuton/case_manager/case/dsl/macro.rb
273
- - lib/teuton/case_manager/case/dsl/main.rb
274
- - lib/teuton/case_manager/case/dsl/send.rb
275
- - lib/teuton/case_manager/case/dsl/target.rb
276
- - lib/teuton/case_manager/case/dsl/unique.rb
277
- - lib/teuton/case_manager/case/main.rb
278
- - lib/teuton/case_manager/case/play.rb
279
- - lib/teuton/case_manager/case/result/ext_array.rb
280
- - lib/teuton/case_manager/case/result/ext_compare.rb
281
- - lib/teuton/case_manager/case/result/ext_filter.rb
282
- - lib/teuton/case_manager/case/result/result.rb
283
- - lib/teuton/case_manager/case/runner.rb
264
+ - lib/teuton/case/builtin/main.rb
265
+ - lib/teuton/case/builtin/package.rb
266
+ - lib/teuton/case/builtin/service.rb
267
+ - lib/teuton/case/builtin/teuton_file.rb
268
+ - lib/teuton/case/builtin/teuton_host.rb
269
+ - lib/teuton/case/builtin/user.rb
270
+ - lib/teuton/case/case.rb
271
+ - lib/teuton/case/close.rb
272
+ - lib/teuton/case/config.rb
273
+ - lib/teuton/case/deprecated/runner.rb
274
+ - lib/teuton/case/deprecated/utils.rb
275
+ - lib/teuton/case/dsl/all.rb
276
+ - lib/teuton/case/dsl/expect.rb
277
+ - lib/teuton/case/dsl/getset.rb
278
+ - lib/teuton/case/dsl/goto.rb
279
+ - lib/teuton/case/dsl/log.rb
280
+ - lib/teuton/case/dsl/macro.rb
281
+ - lib/teuton/case/dsl/send.rb
282
+ - lib/teuton/case/dsl/target.rb
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
289
+ - lib/teuton/case/play.rb
284
290
  - lib/teuton/case_manager/case_manager.rb
285
291
  - lib/teuton/case_manager/check_cases.rb
286
292
  - lib/teuton/case_manager/dsl.rb
287
293
  - lib/teuton/case_manager/export_manager.rb
288
294
  - lib/teuton/case_manager/hall_of_fame.rb
289
- - lib/teuton/case_manager/main.rb
290
295
  - lib/teuton/case_manager/report.rb
296
+ - lib/teuton/case_manager/send_manager.rb
297
+ - lib/teuton/case_manager/show_report.rb
291
298
  - lib/teuton/case_manager/utils.rb
292
299
  - lib/teuton/check/builtin.rb
293
300
  - lib/teuton/check/dsl.rb
@@ -319,10 +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/report/show.rb
323
329
  - lib/teuton/skeleton.rb
330
+ - lib/teuton/utils/application.rb
324
331
  - lib/teuton/utils/configfile_reader.rb
325
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
326
339
  - lib/teuton/utils/verbose.rb
327
340
  - lib/teuton/version.rb
328
341
  homepage: https://github.com/teuton-software/teuton
@@ -1,117 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../application"
4
- require_relative "../../report/report"
5
- require_relative "../../report/show"
6
- require_relative "../utils"
7
- require_relative "main"
8
- require_relative "result/result"
9
- require_relative "builtin/main"
10
-
11
- # TODO: split Case class into several classes:
12
- # * Case, Action?, Session?, RunCommand class
13
-
14
- # Case class
15
- # * initialize
16
- # * export
17
- # * filename
18
- # * grade
19
- # * members
20
- # * skip
21
- # * read_filename ???
22
- class Case
23
- include DSL
24
- include Utils
25
-
26
- attr_accessor :result
27
- attr_accessor :action # TODO: why not reader only???
28
- attr_reader :id, :config, :uniques, :conn_status
29
- attr_reader :skip
30
- @@id = "01" # First case ID value
31
-
32
- ##
33
- # Initialize case from specified config
34
- # @param config (Hash)
35
- def initialize(config)
36
- app = Application.instance
37
- @config = Case::Config.new(local: config, global: app.global)
38
- @groups = app.groups
39
-
40
- @id = @@id
41
- @@id = @@id.next
42
-
43
- # Define Case Report
44
- @report = Report.new(@id)
45
- # TODO: Move folder creation from case to parent classes?
46
- @report.output_dir = File.join("var", @config.global[:tt_testname])
47
- ensure_dir @report.output_dir
48
-
49
- # Default configuration
50
- @skip = false
51
- @skip = get(:tt_skip) unless get(:tt_skip) == "NODATA"
52
- unless app.options["case"].nil?
53
- @skip = true
54
- @skip = false if app.options["case"].include? @id.to_i
55
- end
56
-
57
- @conn_status = {}
58
- @tmpdir = File.join("var", @config.get(:tt_testname), "tmp", @id.to_s)
59
- # ensure_dir @tmpdir # REVISE: When we will need this? Samba?
60
- @remote_tmpdir = File.join("/", "tmp")
61
-
62
- @unique_values = {}
63
- @result = Result.new
64
-
65
- @debug = Application.instance.debug
66
- @verbose = Application.instance.verbose
67
-
68
- @action_counter = 0
69
- @action = {
70
- id: 0,
71
- weight: 1.0,
72
- description: "No description!",
73
- groupname: nil
74
- }
75
- @uniques = []
76
- @sessions = {} # Store opened sessions for this case
77
- tempfile :default
78
- end
79
-
80
- def export(format)
81
- return if skip?
82
-
83
- @report.export format
84
- end
85
-
86
- def filename
87
- @report.filename
88
- end
89
-
90
- def grade
91
- return 0.0 if skip
92
-
93
- @report.tail[:grade]
94
- end
95
-
96
- def members
97
- return "-" if skip
98
-
99
- @report.head[:tt_members] || "noname"
100
- end
101
-
102
- alias_method :skip?, :skip
103
-
104
- private
105
-
106
- def read_filename(filename)
107
- begin
108
- file = File.open(filename, "r")
109
- item = file.readlines
110
- file.close
111
- item.map! { |i| i.sub(/\n/, "") }
112
- rescue
113
- item = []
114
- end
115
- item
116
- end
117
- end