teuton 2.6.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/changelog/todo.md +4 -8
- data/docs/changelog/v2.7.md +11 -0
- data/docs/diagram.md +16 -15
- data/docs/learn/06-cmd_check.md +3 -2
- data/docs/learn/21-exit_codes.md +19 -14
- data/lib/teuton/case/case.rb +25 -44
- data/lib/teuton/case/close.rb +2 -0
- data/lib/teuton/case/config.rb +3 -3
- data/lib/teuton/case/{runner.rb → deprecated/runner.rb} +14 -10
- data/lib/teuton/case/deprecated/utils.rb +40 -0
- data/lib/teuton/case/dsl/all.rb +8 -0
- data/lib/teuton/case/dsl/expect.rb +25 -9
- data/lib/teuton/case/dsl/goto.rb +10 -9
- data/lib/teuton/case/dsl/log.rb +1 -2
- data/lib/teuton/case/dsl/macro.rb +2 -2
- data/lib/teuton/case/dsl/send.rb +3 -8
- data/lib/teuton/case/execute/copy_ssh.rb +70 -0
- data/lib/teuton/case/execute/execute_base.rb +55 -0
- data/lib/teuton/case/execute/execute_local.rb +29 -0
- data/lib/teuton/case/execute/execute_manager.rb +56 -0
- data/lib/teuton/case/execute/execute_ssh.rb +90 -0
- data/lib/teuton/case/execute/execute_telnet.rb +56 -0
- data/lib/teuton/case/play.rb +6 -6
- data/lib/teuton/case_manager/case_manager.rb +12 -8
- data/lib/teuton/case_manager/check_cases.rb +14 -12
- data/lib/teuton/case_manager/dsl.rb +6 -8
- data/lib/teuton/case_manager/export_manager.rb +2 -3
- data/lib/teuton/case_manager/hall_of_fame.rb +9 -10
- data/lib/teuton/case_manager/report.rb +11 -9
- data/lib/teuton/case_manager/show_report.rb +5 -7
- data/lib/teuton/case_manager/utils.rb +2 -48
- data/lib/teuton/check/dsl.rb +1 -2
- data/lib/teuton/check/laboratory.rb +7 -7
- data/lib/teuton/check/show.rb +5 -8
- data/lib/teuton/cli.rb +10 -0
- data/lib/teuton/readme/dsl.rb +5 -7
- data/lib/teuton/readme/lang.rb +3 -2
- data/lib/teuton/readme/readme.rb +15 -18
- data/lib/teuton/report/formatter/default/array.rb +6 -5
- data/lib/teuton/report/formatter/default/txt.rb +1 -0
- data/lib/teuton/report/formatter/formatter.rb +1 -1
- data/lib/teuton/report/formatter/resume/array.rb +3 -3
- data/lib/teuton/report/formatter/resume/html.rb +2 -2
- data/lib/teuton/report/report.rb +6 -5
- data/lib/teuton/skeleton.rb +8 -10
- data/lib/teuton/{application.rb → utils/application.rb} +13 -5
- data/lib/teuton/utils/name_file_finder.rb +40 -45
- data/lib/teuton/utils/project.rb +73 -0
- data/lib/teuton/{result → utils/result}/result.rb +9 -7
- data/lib/teuton/utils/settings.rb +12 -0
- data/lib/teuton/utils/verbose.rb +2 -2
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +19 -18
- metadata +20 -9
- data/lib/teuton/case/dsl.rb +0 -10
- /data/lib/teuton/{result → utils/result}/ext_array.rb +0 -0
- /data/lib/teuton/{result → utils/result}/ext_compare.rb +0 -0
- /data/lib/teuton/{result → utils/result}/ext_filter.rb +0 -0
@@ -1,10 +1,24 @@
|
|
1
1
|
require "rainbow"
|
2
2
|
|
3
|
-
|
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
|
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
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
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
|
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 =
|
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 =
|
70
|
+
config_path = options["cpath"]
|
61
71
|
end
|
62
|
-
|
72
|
+
@config_path = config_path
|
63
73
|
end
|
64
74
|
|
65
|
-
def
|
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
|
-
|
75
|
-
|
76
|
-
|
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
|
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
|
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 =
|
97
|
+
config_name = options["cname"] unless options["cname"].nil?
|
92
98
|
|
93
|
-
config_path = File.join(
|
99
|
+
config_path = File.join(@project_path, config_name + ".json")
|
94
100
|
unless File.exist? config_path
|
95
|
-
config_path = File.join(
|
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 =
|
105
|
+
config_path = options["cpath"]
|
100
106
|
end
|
101
|
-
|
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
|
@@ -15,14 +15,19 @@ require_relative "ext_filter"
|
|
15
15
|
# * value
|
16
16
|
class Result
|
17
17
|
attr_reader :content
|
18
|
-
attr_accessor :
|
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.
|
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
|
-
@
|
55
|
+
@exitcode = -1
|
51
56
|
@value = nil
|
52
57
|
@expected = nil
|
53
58
|
@alterations = []
|
54
59
|
end
|
55
60
|
|
56
61
|
def ok?
|
57
|
-
|
58
|
-
return false if @exitstatus.nil?
|
59
|
-
|
60
|
-
@exitstatus.zero?
|
62
|
+
@exitcode.zero?
|
61
63
|
end
|
62
64
|
|
63
65
|
def restore
|
data/lib/teuton/utils/verbose.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative "
|
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
|
9
|
+
return if Project.quiet?
|
10
10
|
|
11
11
|
print text
|
12
12
|
end
|
data/lib/teuton/version.rb
CHANGED
data/lib/teuton.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
|
-
require_relative "teuton/
|
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
|
-
|
10
|
+
Project.add_input_params(projectpath, options)
|
11
11
|
require_dsl_and_script("teuton/check/laboratory") # Define DSL
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
33
|
-
|
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
|
42
|
-
rescue
|
43
|
-
warn e
|
44
|
-
warn Rainbow.new("[FAIL ] Reading file #{
|
42
|
+
require_relative Project.value[:script_path]
|
43
|
+
rescue => e
|
44
|
+
warn e
|
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.
|
4
|
+
version: 2.7.1
|
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-
|
11
|
+
date: 2023-06-07 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/
|
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,13 @@ 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/copy_ssh.rb
|
285
|
+
- lib/teuton/case/execute/execute_base.rb
|
286
|
+
- lib/teuton/case/execute/execute_local.rb
|
287
|
+
- lib/teuton/case/execute/execute_manager.rb
|
288
|
+
- lib/teuton/case/execute/execute_ssh.rb
|
289
|
+
- lib/teuton/case/execute/execute_telnet.rb
|
281
290
|
- lib/teuton/case/play.rb
|
282
|
-
- lib/teuton/case/runner.rb
|
283
291
|
- lib/teuton/case_manager/case_manager.rb
|
284
292
|
- lib/teuton/case_manager/check_cases.rb
|
285
293
|
- lib/teuton/case_manager/dsl.rb
|
@@ -319,13 +327,16 @@ files:
|
|
319
327
|
- lib/teuton/report/formatter/resume/txt.rb
|
320
328
|
- lib/teuton/report/formatter/resume/yaml.rb
|
321
329
|
- 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
330
|
- lib/teuton/skeleton.rb
|
331
|
+
- lib/teuton/utils/application.rb
|
327
332
|
- lib/teuton/utils/configfile_reader.rb
|
328
333
|
- lib/teuton/utils/name_file_finder.rb
|
334
|
+
- lib/teuton/utils/project.rb
|
335
|
+
- lib/teuton/utils/result/ext_array.rb
|
336
|
+
- lib/teuton/utils/result/ext_compare.rb
|
337
|
+
- lib/teuton/utils/result/ext_filter.rb
|
338
|
+
- lib/teuton/utils/result/result.rb
|
339
|
+
- lib/teuton/utils/settings.rb
|
329
340
|
- lib/teuton/utils/verbose.rb
|
330
341
|
- lib/teuton/version.rb
|
331
342
|
homepage: https://github.com/teuton-software/teuton
|
data/lib/teuton/case/dsl.rb
DELETED
@@ -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
|