teuton 3.0.2 → 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: 93e9ece06ffba48858ef89bfdf6e4e0cddd095d84f6a8fb3de32f1e0c2c713f7
4
- data.tar.gz: a905a098f5ca254323d6eb1b72c4f9970b39082091cc17075f7c02f23cd87997
3
+ metadata.gz: 261ae396c5a6b3841a24a29d4a05284ff3b62da142f3453f39de72ac565f1632
4
+ data.tar.gz: d5e070023f0ea992a0f35367cc0c10110ee205a759a54bd8323aec323d6c2490
5
5
  SHA512:
6
- metadata.gz: 66f9d13f1526f42dd7d68e5e195e9bd304f152ba3447cdc723ed0f417dd299d848bc6867fcc5b03ef1d0848c541c545571e727fe65ec29782ab6944ec7f8beb1
7
- data.tar.gz: 8b5e6b841e08a31f2cfbb76b40377b0dd2eaf63b021c458dfe6908ca04a077be6b61fd4a5e27a04e01d5b34fc62ff9a3fa9df1ecff3d207c2b8315a381f956e4
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
- ```
@@ -4,10 +4,10 @@ require_relative "../../utils/verbose"
4
4
  module DSL
5
5
  def upload(localfilter, args = {})
6
6
  abslocalfilter = if File.absolute_path? localfilter
7
- localfilter
8
- else
9
- File.join(Project.value[:project_path], localfilter)
10
- end
7
+ localfilter
8
+ else
9
+ File.join(Project.value[:project_path], localfilter)
10
+ end
11
11
 
12
12
  Dir.glob(abslocalfilter).each do |abslocalpath|
13
13
  upload_one(abslocalpath, args)
@@ -29,7 +29,7 @@ module DSL
29
29
  host.ip, host.username, password: host.password, port: host.port
30
30
  ) { |sftp| sftp.upload!(localpath, remotepath) }
31
31
  verbose(Rainbow(Settings.letter[:upload]).green)
32
- rescue StandardError => e
32
+ rescue => e
33
33
  log("Upload #{localfile} to #{host.ip}:#{remotepath}", :warn)
34
34
  log(e.to_s, :warn)
35
35
  verbose(Rainbow("!").green)
@@ -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
  ##
@@ -42,7 +43,7 @@ module ReportExtension
42
43
  }
43
44
  else
44
45
  line[:skip] = false
45
- line[:id] = format("%<id>02d", { id: c.id.to_i })
46
+ line[:id] = format("%<id>02d", {id: c.id.to_i})
46
47
  line[:letter] = Settings.letter[:cross] if c.grade.zero?
47
48
  line[:letter] = Settings.letter[:error] if c.grade < 50.0
48
49
  line[:letter] = Settings.letter[:ok] if c.grade.to_i == 100
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,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "3.0.2".freeze
2
+ VERSION = "3.0.3".freeze
3
3
  APPNAME = "teuton".freeze
4
4
  GEMNAME = "teuton".freeze
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}".freeze
data/lib/teuton.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require_relative "teuton/utils/project"
2
- require_relative "teuton/version"
2
+ # require_relative "teuton/version"
3
3
 
4
4
  module Teuton
5
5
  def self.create(path_to_new_dir)
@@ -33,11 +33,6 @@ module Teuton
33
33
  readme.show
34
34
  end
35
35
 
36
- def self.server(projectpath)
37
- require_relative "teuton/config/server"
38
- ConfigServer.configure_project(projectpath)
39
- end
40
-
41
36
  private_class_method def self.require_dsl_and_script(dslpath)
42
37
  # Load DSL file and then load script file
43
38
  require_relative dslpath
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.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz