teuton 3.0.1 → 3.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb5b160c0ddb27676facfc27aab19a9ff581996431ff5a7d5e6ffe5f2a14e1e2
4
- data.tar.gz: 300caee6734f6ddee6d2ee3412c0dc46b4adaa50eaf0914f25827145a61c2993
3
+ metadata.gz: 261ae396c5a6b3841a24a29d4a05284ff3b62da142f3453f39de72ac565f1632
4
+ data.tar.gz: d5e070023f0ea992a0f35367cc0c10110ee205a759a54bd8323aec323d6c2490
5
5
  SHA512:
6
- metadata.gz: 778f4299795b919ce01eb8a2b43f288a36c54fb09fb8fa3deb5870350a5c36cd538f3870d8b666ab50cd25ec7742f7cce46e3002be837f8d15d7f3cece14158b
7
- data.tar.gz: de2a62514669a0ae9e5416d9e8c52f80eb56db81362ae9e4b84f234d83cf556d6f41864d060e016425b460fdfdf2d7969c3bdf4e9f2676bacd50f1e768fff842
6
+ metadata.gz: 9ed7ecd002e02b1f97649b97718f0e67954d338dbab357dc8d7d53cdee553f435a00a6b7934c57a885d7e5ffe99e1907f743ed4072cacad2916013baca7d2245
7
+ data.tar.gz: 664dc37cd6a6f6625ca1db165f30954d5c5038a5ff796d7938fd062ecb38db12344efc533059db2c58317e848af256d2670bfe446fdaea17bbb0c4f71bc1b635
@@ -6,7 +6,6 @@ _Help to create config file._
6
6
 
7
7
  Usage:
8
8
  * `teuton config DIRECTORY`
9
- * `teuton config --server DIRECTORY`
10
9
 
11
10
  ## Suggest config content
12
11
 
@@ -42,79 +41,3 @@ cases:
42
41
  host1_username: TOCHANGE
43
42
  host1_password: TOCHANGE
44
43
  ```
45
-
46
- ## Init Config Server
47
-
48
- _Initialize Config Server, so students connect and help to build config file content._
49
-
50
- * Project files:
51
- ```
52
- foo
53
- ├── config.yaml
54
- └── start.rb
55
- ```
56
-
57
- ```yaml
58
- # File: foo/config.yaml
59
- ---
60
- global:
61
- cases:
62
- - tt_members: TOCHANGE
63
- tt_moodle_id: TOCHANGE
64
- ```
65
-
66
- * `teuton config --server foo`, init config server.
67
- ```
68
- --------------------------------------------------
69
- ConfigServer URL: http://192.168.1.42:8080
70
-
71
- Project path : foo
72
- Global params (0)
73
- Cases params (2)
74
- * tt_members
75
- * tt_moodle_id
76
- --------------------------------------------------
77
- == Sinatra (v4.2.1) has taken the stage on 8080 for development with backup from Puma
78
- Puma starting in single mode...
79
- * Puma version: 7.1.0 ("Neon Witch")
80
- * Ruby version: ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [x86_64-linux]
81
- * Min threads: 0
82
- * Max threads: 5
83
- * Environment: development
84
- * PID: 18938
85
- * Listening on http://0.0.0.0:8080
86
- Use Ctrl-C to stop
87
- ```
88
-
89
- * Now students connect to host 192.168.1.42 and send their configuracion values.
90
- * Student host:
91
-
92
- ![](images/config01.png)
93
-
94
- * Teacher host:
95
-
96
- ![](images/config02.png)
97
-
98
- * When all students submit their data, the teacher presses CTRL-C to end the service
99
- * The received data is saved in separate files within the `config.d` subfolder
100
- * Project files:
101
- ```
102
- foo
103
- ├── config.d
104
- │   ├── from_127.0.0.1.yaml
105
- │   ├── from_192.168.1.14.yaml
106
- │   └── from_192.168.1.28.yaml
107
- ├── config.yaml
108
- └── start.rb
109
- ```
110
-
111
- * And now the main configuration file (config.yaml) has the following content:
112
- * Global param `tt_include: config.d`.
113
- * No cases in main config file. Read case data from files into `config.d` subfolder.
114
-
115
- ```yaml
116
- ---
117
- global:
118
- tt_include: config.d
119
- cases: []
120
- ```
@@ -24,18 +24,19 @@ cases:
24
24
  - tt_members: student_3
25
25
  host1_ip: 127.0.0.1
26
26
  host1_password: secret_3
27
+ tt_skip: true
27
28
  ```
28
29
 
29
- Every remote host definition require some params:
30
+ Every remote host defines its owns params:
30
31
 
31
- | Param | Description | Default value |
32
- | ----- | -------------- | ------------- |
33
- | ip | Remote host IP | |
34
- | port | Remote host port | 22 |
32
+ | Param | Description | Default value |
33
+ | -------- | ------------------- | -------------- |
34
+ | ip | Remote host IP | IP or hostname |
35
+ | port | Remote host port | 22 |
35
36
  | username | Remote user account | Not required with public SSH id |
36
37
  | password | Remote user pasword | Not required with public SSH id |
37
- | protocol | SSH or Telner | SSH |
38
- | route | Defines host2 used as gateway to reach host | |
38
+ | protocol | SSH or Telnet | SSH |
39
+ | route | Defines intermediate host used as gateway to reach principal host | |
39
40
 
40
41
  ## Definition section
41
42
 
@@ -55,12 +56,12 @@ Execution:
55
56
 
56
57
  ```
57
58
  $ teuton run examples/03-remote_hosts
58
-
59
+
59
60
  CASE RESULTS
60
61
  +------+-----------+-------+-------+
61
62
  | CASE | MEMBERS | GRADE | STATE |
62
63
  | 01 | student_1 | 0.0 | ? |
63
- | 02 | student_2 | 0.0 | ? |
64
+ | - | - | 0.0 | S |
64
65
  | 03 | student_3 | 100.0 | ✔ |
65
66
  +------+-----------+-------+-------+
66
67
 
@@ -68,8 +69,8 @@ CONN ERRORS
68
69
  +------+-----------+-------+------------------+
69
70
  | CASE | MEMBERS | HOST | ERROR |
70
71
  | 01 | student_1 | host1 | host_unreachable |
71
- | 02 | student_2 | host1 | host_unreachable |
72
72
  +------+-----------+-------+------------------+
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).
@@ -81,7 +82,6 @@ $ tree var/03-remote_hosts
81
82
 
82
83
  var/03-remote_hosts
83
84
  ├── case-01.txt
84
- ├── case-02.txt
85
85
  ├── case-03.txt
86
86
  ├── moodle.csv
87
87
  └── resume.txt
@@ -28,7 +28,7 @@ module DSL
28
28
  Net::SFTP.start(
29
29
  host.ip, host.username, password: host.password, port: host.port
30
30
  ) { |sftp| sftp.upload!(localpath, remotepath) }
31
- verbose(Rainbow(Settings.letter(:upload)).green)
31
+ verbose(Rainbow(Settings.letter[:upload]).green)
32
32
  rescue => e
33
33
  log("Upload #{localfile} to #{host.ip}:#{remotepath}", :warn)
34
34
  log(e.to_s, :warn)
@@ -1,6 +1,7 @@
1
1
  require "rainbow"
2
2
  require_relative "../../utils/project"
3
3
  require_relative "../../utils/settings"
4
+ require_relative "../../version"
4
5
 
5
6
  module ReportExtension
6
7
  ##
@@ -34,7 +35,7 @@ module ReportExtension
34
35
  skip: true,
35
36
  id: "-",
36
37
  grade: 0.0,
37
- letter: Settings.letter(:skip),
38
+ letter: Settings.letter[:skip],
38
39
  members: "-",
39
40
  conn_status: {},
40
41
  moodle_id: "",
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
 
@@ -113,4 +113,8 @@ class CLI < Thor
113
113
  # Respond to missing methods name
114
114
  super
115
115
  end
116
+
117
+ def self.exit_on_failure?
118
+ true
119
+ end
116
120
  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 => e
63
+ rescue StandardError => e
64
64
  warn "[ERROR] ConfigFileReader.read_yaml: #{e}"
65
65
  warn "[ERROR] Revise file content! <#{filepath}>"
66
66
  exit 1
@@ -88,12 +88,12 @@ 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
- filepaths.each { |filepath|
96
+ filepaths.each do |filepath|
97
97
  if File.directory?(filepath)
98
98
  next
99
99
  elsif is_yaml_file? filepath
@@ -104,15 +104,16 @@ module ConfigFileReader
104
104
  warn "[WARN] Ignore config file <#{filepath}>. No yaml or json extension!"
105
105
  next
106
106
  end
107
- }
107
+ end
108
108
  end
109
109
 
110
110
  def self.read_included_yaml_file(filepath)
111
111
  begin
112
112
  data = YAML.load(File.open(filepath))
113
- rescue => e
114
- warn "[ERROR] ConfigFileReader.read_included_yaml: #{e}"
115
- warn "[ERROR] Loading configuration file! <#{filename}>"
113
+ rescue StandardError => e
114
+ warn "[ERROR] Reading configurations from yaml:"
115
+ warn "[ERROR] - File : #{filepath}"
116
+ warn "[ERROR] - Type : #{e}"
116
117
  exit 1
117
118
  end
118
119
  data[:tt_source_file] = relative_path(filepath)
@@ -122,9 +123,10 @@ module ConfigFileReader
122
123
  def self.read_included_json_file(filepath)
123
124
  begin
124
125
  data = JSON.parse(File.read(filepath), symbolize_names: true)
125
- rescue => e
126
- warn "[ERROR] ConfigFileReader.read_included_json: #{e}"
127
- warn "[ERROR] Loading configuration file! <#{filename}>"
126
+ rescue StandardError => e
127
+ warn "[ERROR] Reading configurations from json:"
128
+ warn "[ERROR] - File : #{filepath}"
129
+ warn "[ERROR] - Type : #{e}"
128
130
  exit 1
129
131
  end
130
132
  data[:tt_source_file] = relative_path(filepath)
@@ -1,7 +1,7 @@
1
1
  module Teuton
2
- VERSION = "3.0.1"
3
- APPNAME = "teuton"
4
- GEMNAME = "teuton"
5
- DOCKERNAME = "dvarrui/#{GEMNAME}"
6
- HOMEPAGE = "https://github.com/teuton-software/teuton"
2
+ VERSION = "3.0.3".freeze
3
+ APPNAME = "teuton".freeze
4
+ GEMNAME = "teuton".freeze
5
+ DOCKERNAME = "dvarrui/#{GEMNAME}".freeze
6
+ HOMEPAGE = "https://github.com/teuton-software/teuton".freeze
7
7
  end
data/lib/teuton.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "teuton/utils/project"
2
+ # require_relative "teuton/version"
2
3
 
3
4
  module Teuton
4
5
  def self.create(path_to_new_dir)
@@ -32,19 +33,17 @@ module Teuton
32
33
  readme.show
33
34
  end
34
35
 
35
- def self.server(projectpath)
36
- require_relative "teuton/config/server"
37
- ConfigServer.configure_project(projectpath)
38
- end
39
-
40
36
  private_class_method def self.require_dsl_and_script(dslpath)
41
37
  # Load DSL file and then load script file
42
38
  require_relative dslpath
43
39
  begin
44
- require_relative Project.value[:script_path]
40
+ mainscriptfile = Project.value[:script_path]
41
+ require_relative mainscriptfile
45
42
  rescue StandardError => e
46
- warn Rainbow("[ERROR] require_dsl_and_script: <#{e}>").bright.red
47
- warn Rainbow("[ERROR] Reading file #{Project.value[:script_path]}").bright.red
43
+ warn Rainbow("[ERROR] #{e}").bright.red
44
+ e.backtrace&.first(3)&.each do |line|
45
+ warn Rainbow("[ERROR] #{line}").red
46
+ end
48
47
  exit 1
49
48
  end
50
49
  end
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.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz