teuton 3.0.3 → 3.1.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.
data/docs/config_file.md CHANGED
@@ -65,17 +65,18 @@ It is posible to add as many parameters as you need. But remember that parameter
65
65
 
66
66
  It is posible to add all the parameters you need into your configuration file, but some parameter names has special meaning. Reserved parameter names begin with prefix `tt_`.
67
67
 
68
- | Param name | Section | Status | Descripction |
69
- | -------------------- | ------- | ------------ | ------------ |
70
- | **tt_members** | cases | **Required** | Student name if it is an individual assignment or names of the members if it is a group assignment |
71
- **tt_moodle_id** | cases | Optional | Student identifier on the Moodle platform. Example: student's Moodle email address |
72
- | **tt_moodle_max_score** | global | Optional | Default value: 100. The grades generated by Teuton have values ​​between 0 and 100. But by changing this parameter to 10, for exmaple, the values are adjusted to between 0 and 10 before saving the grades into the moodle.csv file |
73
- | **tt_include** | global | Optional | The contents of the files within the directory defined by the parameter are added to our main configuration file |
74
- | **tt_sequence** | global | Optional | By default, all cases are evaluated in parallel unless sequential mode is enabled. Sequential mode is useful for debugging processes.|
75
- | **tt_source_ip** | cases | Auto | Automatically filled in during remote setup. This value is completed when the student sends their configuration remotely.|
76
- | **tt_source_file** | cases | Auto | Automatically filled in during the configuration loading. This value is populated when the configuration files from the folder defined by the tt_include parameter are read. |
77
- | **tt_skip** | | Optional | False by default. To skip a case and not evaluate it, set the value to true. |
78
- | **tt_testname** | global | Optional | Customize your test name |
68
+ | Param name | Section | Status | Descripction |
69
+ | ----------------------- | ------- | ------------ | ------------ |
70
+ | **tt_members** | cases | **REQUIRED** | Student name if it is an individual assignment or names of the members if it is a group assignment |
71
+ | **tt_moodle_id** | cases | Optional | Student identifier on the Moodle platform. Example: student's Moodle email address |
72
+ | **tt_include** | global | Optional | The contents of the files within the directory defined by the parameter are added to our main configuration file |
73
+ | **tt_moodle_max_score** | global | Optional | Default value: 100. The grades generated by Teuton have values ​​between 0 and 100. But by changing this parameter to 10, for exmaple, the values are adjusted to between 0 and 10 before saving the grades into the moodle.csv file |
74
+ | **tt_output_dir** | globsal | Optional | Change default output directory (`var/TESNAME`)|
75
+ | **tt_sequence** | global | Optional | By default, all cases are evaluated in parallel unless sequential mode is enabled. Sequential mode is useful for debugging processes.|
76
+ | **tt_testname** | global | Optional | Change default test name |
77
+ | **tt_source_ip** | cases | AUTO | Automatically filled in during remote setup. This value is completed when the student sends their configuration remotely.|
78
+ | **tt_source_file** | cases | AUTO | Automatically filled in during the configuration loading. This value is populated when the configuration files from the folder defined by the tt_include parameter are read. |
79
+ | **tt_skip** | | Optional | False by default. To skip a case and not evaluate it, set the value to true. |
79
80
 
80
81
  ## Host properties
81
82
 
@@ -83,14 +84,14 @@ Parameters used to define the properties of each host must begin with an identif
83
84
 
84
85
  Lits of available host properties:
85
86
 
86
- | Param name | Required | Default value | Description |
87
- | --------------- | -------- | ------------- | ----------- |
88
- | HOSTID_ip | Yes | | IP address or hostname of the host identified by HOSTID |
89
- | HOSTID_username | No | | User account to access HOSTID |
90
- | HOSTID_password | No | | Password to access HOSTID |
91
- | HOSTID_protocol | No | ssh | Available options: ssh (default), telnet |
92
- | HOSTID_port | No | 22/23 | Default value: 22 (ssh), 23 (telnet) |
93
- | HOSTID_route | No | | This option is used to configure a gateway to access HOSTID |
87
+ | Param name | Required | Default | Description |
88
+ | --------------- | -------- | ------- | ----------- |
89
+ | HOSTID_ip | Yes | | IP address or hostname of the host identified by HOSTID |
90
+ | HOSTID_username | No | | User account to access HOSTID |
91
+ | HOSTID_password | No | | Password to access HOSTID |
92
+ | HOSTID_protocol | No | ssh | Available options: ssh (default), telnet |
93
+ | HOSTID_port | No | 22/23 | Default value: 22 (ssh), 23 (telnet) |
94
+ | HOSTID_route | No | | This option is used to configure a gateway to access HOSTID |
94
95
 
95
96
  We can create as many host configurations as different devices are required to complete the activity.
96
97
 
@@ -21,10 +21,10 @@ cases:
21
21
  - tt_members: student_2
22
22
  host1_ip: 192.168.1.202
23
23
  host1_password: secret_2
24
+ tt_skip: true
24
25
  - tt_members: student_3
25
26
  host1_ip: 127.0.0.1
26
27
  host1_password: secret_3
27
- tt_skip: true
28
28
  ```
29
29
 
30
30
  Every remote host defines its owns params:
@@ -73,7 +73,11 @@ CONN ERRORS
73
73
 
74
74
  ```
75
75
 
76
- Notice that case-03 is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1).
76
+ Notice that:
77
+
78
+ * `case-01` is 0% because remote host is unreachable.
79
+ * `case-02` is 0% because `tt_skip: true` param.
80
+ * `case-03` is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1).
77
81
 
78
82
  Results:
79
83
 
@@ -90,6 +94,11 @@ var/03-remote_hosts
90
94
  ## tt_skip param
91
95
 
92
96
  To disable a case, add skip param to config file. Example: `tt_skip: true`.
93
- * `tt_skip` it is false by default.
94
- * `tt_skip: false` ignore this case.
95
- * `tt_skip: true`, evaluate this case.
97
+
98
+ * By default, `tt_skip: false`, so all cases are processed.
99
+ * `tt_skip: false`
100
+ - defined in `case` section, ignore that case.
101
+ - defined in `global` section, ignore all cases by default.
102
+ * `tt_skip: true`
103
+ - defined in `case` section, evaluate that case.
104
+ - defined in `global` section, evaluate all cases by default.
@@ -8,6 +8,7 @@ By default, `config.yaml` is our config file. Example:
8
8
 
9
9
  ```yaml
10
10
  global:
11
+ tt_output_dir: var/04-config/default
11
12
  cases:
12
13
  - tt_members: student_1
13
14
  username: david
@@ -15,7 +16,7 @@ cases:
15
16
  username: fran
16
17
  ```
17
18
 
18
- > **How to choose another config file?** Read this [document](../commands/run-test.md#3-choosing-config-file).
19
+ > **How to choose another config file?** Read this [document](../commands/run.md#3-choosing-config-file).
19
20
 
20
21
  By default, `start.rb` it's our main execution file. Example:
21
22
 
@@ -47,7 +48,7 @@ CASE RESULTS
47
48
  Reports:
48
49
 
49
50
  ```
50
- var/04-config
51
+ var/04-config/default
51
52
  ├── case-01.txt
52
53
  ├── case-02.txt
53
54
  ├── moodle.csv
@@ -57,57 +58,56 @@ var/04-config
57
58
  Let's see case 01 report.
58
59
 
59
60
  ```
60
- $ more var/04-config/case-01.txt
61
+ $ more var/04-config/default/case-01.txt
61
62
 
62
63
  CONFIGURATION
63
- +-------------+------------+
64
- | tt_members | student_1 |
65
- | tt_sequence | false |
66
- | tt_skip | false |
67
- | tt_testname | 04-config |
68
- | username | david |
69
- +-------------+------------+
64
+ +----------------+--------------------------------+
65
+ | tt_config_path | examples/04-config/config.yaml |
66
+ | tt_members | student_1 |
67
+ | tt_output_dir | var/04-config/default |
68
+ | tt_script_path | examples/04-config/start.rb |
69
+ | tt_sequence | false |
70
+ | tt_skip | false |
71
+ | username | david |
72
+ +----------------+--------------------------------+
73
+
70
74
 
71
75
  GROUPS
72
76
  - Reading params from config file
73
77
  01 (1.0/1.0)
74
78
  Description : Create user david
75
79
  Command : id david
76
- Duration : 0.002 (local)
77
- Alterations : find(david) & count
78
- Expected : Greater than 0 (String)
79
- Result : 1 (Integer)
80
+ Output : uid=1000(david) gid=1000(david) grupos=1000(david),478(wheel),...
81
+ Duration : 0.005 (local)
82
+ Alterations : find(uid=) & find((david)) & find(gid=) & count
83
+ Expected : Greater than 0
84
+ Result : 1
80
85
 
81
86
  RESULTS
82
87
  +--------------+---------------------------+
83
- | case_id | 01 |
84
- | start_time | 2023-01-25 20:46:13 +0000 |
85
- | finish_time | 2023-01-25 20:46:13 +0000 |
86
- | duration | 0.001778546 |
87
88
  | unique_fault | 0 |
89
+ | case_id | 01 |
90
+ | start_time | 2026-10-10 17:05:22 +0100 |
91
+ | finish_time | 2026-10-10 17:05:22 +0100 |
92
+ | duration | 0.005137538 |
88
93
  | max_weight | 1.0 |
89
94
  | good_weight | 1.0 |
90
- | fail_weight | 0.0 |
95
+ | fail_weight | 0 |
91
96
  | fail_counter | 0 |
92
97
  | grade | 100 |
93
- +--------------+---------------------------+```
98
+ +--------------+---------------------------+
94
99
  ```
95
100
 
96
101
  ## Using differents configuration files
97
102
 
98
- Example with 3 differents config files (yaml files):
103
+ Execute the same test but using diferents config files. Config files available:
99
104
 
100
- ```
101
- $ tree examples/04-config
105
+ * config.yaml
106
+ * rock.yaml
107
+ * starwars.yaml
102
108
 
103
- examples/04-config
104
- ├── config.yaml
105
- ├── rock.yaml
106
- ├── start.rb
107
- └── starwars.yaml
108
- ```
109
+ **Example 1**: Run test usign default config file (`config.yaml`). Output files saved in `tt_output_dir: var/04-config/defautl`.
109
110
 
110
- **Example 1**: Run test usign default config file (`config.yaml`).
111
111
  ```
112
112
  $ teuton run examples/04-config
113
113
 
@@ -119,7 +119,8 @@ CASE RESULTS
119
119
  +------+-----------+-------+-------+
120
120
  ```
121
121
 
122
- **Example 2**: Run test using `example/04-config/starwars.yaml` config file.
122
+ **Example 2**: Run test using `example/04-config/starwars.yaml` config file. Output files saved in `tt_output_dir: var/04-config/starwars`.
123
+
123
124
  ```
124
125
  $ teuton run --cname=starwars examples/04-config
125
126
 
@@ -131,7 +132,8 @@ CASE RESULTS
131
132
  +------+------------+-------+-------+
132
133
  ```
133
134
 
134
- **Example 3**: Run test using `example/04-config/rock.yaml` config file.
135
+ **Example 3**: Run test using `example/04-config/rock.yaml` config file. Output files saved in `tt_output_dir: var/04-config/rock`.
136
+
135
137
  ```
136
138
  $ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
137
139
 
data/docs/learn/05-use.md CHANGED
@@ -60,3 +60,31 @@ group "Using file: network" do
60
60
  expect "www.google.es has address "
61
61
  end
62
62
  ```
63
+
64
+ ## `tt_testname` param
65
+
66
+ The `tt_testname: 05-import_files` param changes the default test name.
67
+
68
+ ```yaml
69
+ # File: config.yaml
70
+ ---
71
+ global:
72
+ host1_username: root
73
+ tt_testname: '05-import_files'
74
+ cases:
75
+ ...
76
+ ```
77
+
78
+ So, output files are saved into `var/05-import_files` instead of `05-use`:
79
+
80
+ ```
81
+ > tree var
82
+
83
+ var
84
+ └── 05-import_files
85
+ ├── case-01.txt
86
+ ├── case-02.txt
87
+ ├── case-03.txt
88
+ ├── moodle.csv
89
+ └── resume.txt
90
+ ```
@@ -34,7 +34,7 @@ class Case
34
34
 
35
35
  # Define Case Report
36
36
  @report = Report.new(@id)
37
- @report.output_dir = File.join("var", @config.global[:tt_testname])
37
+ @report.output_dir = Project.value[:output_dir]
38
38
 
39
39
  # Default configuration
40
40
  @skip = false
@@ -45,7 +45,7 @@ class Case
45
45
  end
46
46
  @verbose = Project.value[:verbose]
47
47
 
48
- @tmpdir = File.join("var", @config.get(:tt_testname), "tmp", @id.to_s)
48
+ @tempdir = File.join(Project.value[:output_dir], "tmp", @id.to_s)
49
49
 
50
50
  @unique_values = {}
51
51
  @result = Result.new
@@ -52,14 +52,14 @@ module DSL
52
52
  name = input
53
53
  name = "teuton.tmp" if input == :default
54
54
 
55
- @action[:tempfile] = File.join(@tmpdir, name)
55
+ @action[:tempfile] = File.join(@tempdir, name)
56
56
  @action[:remote_tempfile] = File.join(remote_tempdir, name)
57
57
 
58
58
  @action[:tempfile]
59
59
  end
60
60
 
61
61
  def tempdir
62
- @tmpdir
62
+ @tempdir
63
63
  end
64
64
 
65
65
  def remote_tempfile
@@ -24,9 +24,7 @@ class ExportManager
24
24
 
25
25
  # Step 1: Validate options
26
26
  options = strings2symbols(args)
27
- if options[:format].nil?
28
- options[:format] = Project.value[:format]
29
- end
27
+ options[:format] = Project.value[:format] if options[:format].nil?
30
28
 
31
29
  unless Formatter.available_formats.include? options[:format]
32
30
  puts Rainbow("[WARN] ExportManager: Unkown format!").yellow.bright
@@ -74,7 +72,7 @@ class ExportManager
74
72
  def preserve_files
75
73
  srcdir = File.join(
76
74
  Project.value[:output_basedir],
77
- Project.value[:test_name]
75
+ Project.value[:testname]
78
76
  )
79
77
 
80
78
  t = Time.now
@@ -7,27 +7,23 @@ require_relative "../../utils/project"
7
7
  module CheckCasesExtension
8
8
  def check_cases!
9
9
  # Start checking every single case
10
- app = Project.value
11
10
  # Load configurations from config file
12
11
  configdata = ConfigFileReader.call(Project.value[:config_path])
13
- app[:ialias] = configdata[:alias]
14
- app[:global] = configdata[:global]
15
- app[:global][:tt_testname] = app[:global][:tt_testname] || app[:test_name]
16
- app[:global][:tt_sequence] = false if app[:global][:tt_sequence].nil?
12
+ Project.add_config(configdata)
17
13
 
18
14
  # Create out dir
19
- outdir = app[:global][:tt_outdir] || File.join("var", app[:global][:tt_testname])
20
- FileUtils.mkdir_p(outdir) unless Dir.exist?(outdir)
21
- @report.output_dir = outdir
15
+ output_dir = Project.value[:output_dir]
16
+ FileUtils.mkdir_p(output_dir) unless Dir.exist?(output_dir)
17
+ @report.output_dir = output_dir
22
18
 
23
19
  # Fill report head
24
- open_main_report(app[:config_path])
20
+ open_main_report(Project.value[:config_path])
25
21
 
26
22
  # create cases and run
27
23
  configdata[:cases].each { |config| @cases << Case.new(config) }
28
24
  start_time = run_all_cases # run cases
29
25
 
30
- # TODO: merge these 2 methdos
26
+ # TODO: merge these 2 methods
31
27
  # TODO: CloseManager.call ???
32
28
  uniques = collect_uniques_for_all_cases
33
29
  close_reports_for_all_cases(uniques)
@@ -3,7 +3,7 @@ require_relative "../utils/project"
3
3
 
4
4
  class SendManager
5
5
  def initialize
6
- logpath = File.join(Project.value[:output_basedir], Project.value[:test_name], "send.log")
6
+ logpath = File.join(Project.value[:output_basedir], Project.value[:testname], "send.log")
7
7
  @logfile = File.open(logpath, "a")
8
8
  end
9
9
 
@@ -2,7 +2,7 @@ require_relative "../utils/project"
2
2
 
3
3
  class StatsManager
4
4
  def initialize
5
- filepath = File.join(Project.value[:output_basedir], Project.value[:test_name], "stats.txt")
5
+ filepath = File.join(Project.value[:output_basedir], Project.value[:testname], "stats.txt")
6
6
  @file = File.open(filepath, "w")
7
7
  end
8
8
 
data/lib/teuton/cli.rb CHANGED
@@ -44,7 +44,7 @@ class CLI < Thor
44
44
  LONGDESC
45
45
  def config(projectpath)
46
46
  # Check Test: suggest the content of the configuration file based on the test
47
- opt = { "onlyconfig" => true }
47
+ opt = {"onlyconfig" => true}
48
48
  Teuton.check(projectpath, opt)
49
49
  end
50
50
 
@@ -11,8 +11,7 @@ class Readme
11
11
  include DSL
12
12
  include ReadmeDSL
13
13
 
14
- attr_reader :result
15
- attr_reader :data
14
+ attr_reader :result, :data
16
15
 
17
16
  def initialize(script_path, config_path)
18
17
  @path = {}
@@ -66,7 +65,7 @@ class Readme
66
65
  puts format(Lang.get(:version), Teuton::VERSION)
67
66
  puts "```"
68
67
  puts "\n"
69
- puts "# Test: #{Project.value[:test_name]}\n"
68
+ puts "# Test: #{Project.value[:testname]}\n"
70
69
 
71
70
  i = 1
72
71
  unless @required_hosts.empty?
@@ -83,11 +82,11 @@ class Readme
83
82
  puts "\n> NOTE: SSH Service installation is required on every host."
84
83
  end
85
84
 
86
- unless @cases_params.empty?
87
- @cases_params.sort!
88
- puts Lang.get(:params)
89
- @cases_params.uniq.each { |i| puts format("* %s", i) }
90
- end
85
+ return if @cases_params.empty?
86
+
87
+ @cases_params.sort!
88
+ puts Lang.get(:params)
89
+ @cases_params.uniq.each { |i| puts format("* %s", i) }
91
90
  end
92
91
 
93
92
  def show_content
@@ -98,9 +97,7 @@ class Readme
98
97
  group[:readme].each { |line| puts "#{line}\n" }
99
98
  previous_host = nil
100
99
  group[:actions].each_with_index do |item, index|
101
- if item[:host].nil? && index.positive?
102
- item[:host] = group[:actions][0][:host]
103
- end
100
+ item[:host] = group[:actions][0][:host] if item[:host].nil? && index.positive?
104
101
  if previous_host.nil? || item[:host] != previous_host
105
102
  previous_host = item[:host] || "null"
106
103
  puts format(Lang.get(:goto), previous_host.upcase)
@@ -127,12 +124,12 @@ class Readme
127
124
  puts "| ----- | ----- |"
128
125
  @global_params.each_pair { |k, v| puts "|#{k}|#{v}|" }
129
126
  end
130
- if @setted_params.size.positive?
131
- puts Lang.get(:created_params)
132
- puts "\n"
133
- puts "| Param |"
134
- puts "| ----- |"
135
- @setted_params.each_pair { |k, v| puts "|#{k}|" }
136
- end
127
+ return unless @setted_params.size.positive?
128
+
129
+ puts Lang.get(:created_params)
130
+ puts "\n"
131
+ puts "| Param |"
132
+ puts "| ----- |"
133
+ @setted_params.each_pair { |k, v| puts "|#{k}|" }
137
134
  end
138
135
  end
@@ -37,7 +37,7 @@ module ConfigFileReader
37
37
  data = {}
38
38
  data[:global] = {}
39
39
  data[:alias] = {}
40
- data[:cases] = [{ tt_members: "anonymous" }]
40
+ data[:cases] = [{tt_members: "anonymous"}]
41
41
  data
42
42
  end
43
43
 
@@ -60,7 +60,7 @@ module ConfigFileReader
60
60
  def self.read_yaml(filepath)
61
61
  begin
62
62
  data = YAML.load(File.open(filepath))
63
- rescue StandardError => e
63
+ rescue => e
64
64
  warn "[ERROR] ConfigFileReader.read_yaml: #{e}"
65
65
  warn "[ERROR] Revise file content! <#{filepath}>"
66
66
  exit 1
@@ -88,10 +88,10 @@ module ConfigFileReader
88
88
 
89
89
  include_dir = data[:global][:tt_include]
90
90
  basedir = if include_dir == File.absolute_path(include_dir)
91
- include_dir
92
- else
93
- File.join(File.dirname(filepath), data[:global][:tt_include])
94
- end
91
+ include_dir
92
+ else
93
+ File.join(File.dirname(filepath), data[:global][:tt_include])
94
+ end
95
95
  filepaths = Dir.glob(File.join(basedir, "**/*"))
96
96
  filepaths.each do |filepath|
97
97
  if File.directory?(filepath)
@@ -110,7 +110,7 @@ module ConfigFileReader
110
110
  def self.read_included_yaml_file(filepath)
111
111
  begin
112
112
  data = YAML.load(File.open(filepath))
113
- rescue StandardError => e
113
+ rescue => e
114
114
  warn "[ERROR] Reading configurations from yaml:"
115
115
  warn "[ERROR] - File : #{filepath}"
116
116
  warn "[ERROR] - Type : #{e}"
@@ -123,7 +123,7 @@ module ConfigFileReader
123
123
  def self.read_included_json_file(filepath)
124
124
  begin
125
125
  data = JSON.parse(File.read(filepath), symbolize_names: true)
126
- rescue StandardError => e
126
+ rescue => e
127
127
  warn "[ERROR] Reading configurations from json:"
128
128
  warn "[ERROR] - File : #{filepath}"
129
129
  warn "[ERROR] - Type : #{e}"
@@ -1,18 +1,14 @@
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
4
+ attr_reader :options, :project_path, :script_path, :config_path, :testname
9
5
 
10
6
  def initialize(options = {})
11
7
  @options = options
12
8
  @project_path = nil
13
9
  @script_path = nil # Path to DSL script file
14
10
  @config_path = nil # Path to YAML config file
15
- @test_name = nil
11
+ @testname = nil
16
12
  end
17
13
 
18
14
  ##
@@ -44,7 +40,7 @@ class NameFileFinder
44
40
 
45
41
  @project_path = folder_path
46
42
  @script_path = script_path
47
- @test_name = folder_path.split(File::SEPARATOR)[-1]
43
+ @testname = folder_path.split(File::SEPARATOR)[-1]
48
44
 
49
45
  find_configfilename_from_directory(folder_path)
50
46
  end
@@ -59,9 +55,7 @@ class NameFileFinder
59
55
  # Config name file is introduced by cname arg option from teuton command
60
56
  config_name = options["cname"] unless options["cname"].nil?
61
57
  config_path = File.join(folder_path, "#{config_name}.json")
62
- unless File.exist? config_path
63
- config_path = File.join(folder_path, "#{config_name}.yaml")
64
- end
58
+ config_path = File.join(folder_path, "#{config_name}.yaml") unless File.exist? config_path
65
59
  else
66
60
  # Config path file is introduced by cpath arg option from teuton command
67
61
  config_path = options["cpath"]
@@ -81,7 +75,7 @@ class NameFileFinder
81
75
 
82
76
  @project_path = File.dirname(script_path)
83
77
  @script_path = script_path
84
- @test_name = File.basename(script_path, ".rb")
78
+ @testname = File.basename(script_path, ".rb")
85
79
  find_configfilenames_from_rb(script_path)
86
80
  end
87
81
 
@@ -95,9 +89,7 @@ class NameFileFinder
95
89
  config_name = options["cname"] unless options["cname"].nil?
96
90
 
97
91
  config_path = File.join(@project_path, config_name + ".json")
98
- unless File.exist? config_path
99
- config_path = File.join(@project_path, config_name + ".yaml")
100
- end
92
+ config_path = File.join(@project_path, config_name + ".yaml") unless File.exist? config_path
101
93
  else
102
94
  # Config path file is introduced by cpath arg option from teuton command
103
95
  config_path = options["cpath"]
@@ -7,6 +7,7 @@ class Project
7
7
  @project = {}
8
8
  @project[:running_basedir] = Dir.getwd
9
9
  @project[:output_basedir] = "var"
10
+ @project[:output_dir] = @project[:output_basedir]
10
11
  @project[:name] = "teuton"
11
12
  @project[:format] = :txt # Default export format
12
13
  @project[:debug] = false # Disable/enable local executions
@@ -42,7 +43,7 @@ class Project
42
43
  # Preprocess input options:
43
44
  # * Convert input case options String to an Array of integers
44
45
  # * Read color input option
45
- def self.add_input_params(projectpath, options)
46
+ def self.add_options(projectpath, options)
46
47
  value[:options].merge! options
47
48
  Rainbow.enabled = value[:options]["color"]
48
49
 
@@ -51,7 +52,7 @@ class Project
51
52
  value[:project_path] = finder.project_path
52
53
  value[:script_path] = finder.script_path
53
54
  value[:config_path] = finder.config_path
54
- value[:test_name] = finder.test_name
55
+ value[:testname] = finder.testname
55
56
 
56
57
  return if value[:options]["case"].nil?
57
58
 
@@ -59,6 +60,19 @@ class Project
59
60
  value[:options]["case"] = numbers.collect!(&:to_i)
60
61
  end
61
62
 
63
+ def self.add_config(configdata)
64
+ # Load configurations from config file
65
+ value[:ialias] = configdata[:alias] || {}
66
+ value[:global] = configdata[:global] || {}
67
+ value[:global][:tt_sequence] = false if value[:global][:tt_sequence].nil?
68
+ running_basedir = "#{value[:running_basedir]}/"
69
+ value[:global][:tt_script_path] = value[:script_path].gsub(running_basedir, "")
70
+ value[:global][:tt_config_path] = value[:config_path].gsub(running_basedir, "")
71
+
72
+ value[:testname] = value[:global][:tt_testname] if value[:global][:tt_testname]
73
+ value[:output_dir] = (value[:global][:tt_output_dir] || File.join(value[:output_basedir], value[:testname]))
74
+ end
75
+
62
76
  def self.relative_path(filepath)
63
77
  if filepath.start_with?(Dir.pwd)
64
78
  filepath[Dir.pwd.length + 1, filepath.length]
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "3.0.3".freeze
2
+ VERSION = "3.1.0".freeze
3
3
  APPNAME = "teuton".freeze
4
4
  GEMNAME = "teuton".freeze
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}".freeze
data/lib/teuton.rb CHANGED
@@ -8,7 +8,7 @@ module Teuton
8
8
  end
9
9
 
10
10
  def self.check(projectpath, options = {})
11
- Project.add_input_params(projectpath, options)
11
+ Project.add_options(projectpath, options)
12
12
  require_dsl_and_script("teuton/check/main")
13
13
  require_relative "teuton/check/checker"
14
14
  checker = Checker.new(
@@ -19,12 +19,12 @@ module Teuton
19
19
  end
20
20
 
21
21
  def self.run(projectpath, options = {})
22
- Project.add_input_params(projectpath, options)
22
+ Project.add_options(projectpath, options)
23
23
  require_dsl_and_script("teuton/case_manager/dsl")
24
24
  end
25
25
 
26
26
  def self.readme(projectpath, options = {})
27
- Project.add_input_params(projectpath, options)
27
+ Project.add_options(projectpath, options)
28
28
  require_dsl_and_script("teuton/readme/main")
29
29
  readme = Readme.new(
30
30
  Project.value[:script_path],
@@ -39,7 +39,7 @@ module Teuton
39
39
  begin
40
40
  mainscriptfile = Project.value[:script_path]
41
41
  require_relative mainscriptfile
42
- rescue StandardError => e
42
+ rescue => e
43
43
  warn Rainbow("[ERROR] #{e}").bright.red
44
44
  e.backtrace&.first(3)&.each do |line|
45
45
  warn Rainbow("[ERROR] #{line}").red
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.0.3
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
@@ -349,7 +349,7 @@ files:
349
349
  - lib/teuton/version.rb
350
350
  homepage: https://github.com/teuton-software/teuton
351
351
  licenses:
352
- - MPL-2.0
352
+ - AGPL-3.0
353
353
  metadata: {}
354
354
  rdoc_options: []
355
355
  require_paths: