teuton 2.9.5 → 2.10.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.
@@ -1,17 +1,33 @@
1
1
  require "rainbow"
2
2
 
3
3
  class SendManager
4
+ def initialize
5
+ logpath = File.join(Project.value[:output_basedir], Project.value[:test_name], "send.log")
6
+ @logfile = File.open(logpath, "a")
7
+ end
8
+
4
9
  ##
5
- # Execute "send" order: Send every case report
10
+ # Execute "send" order: Copy every case report to remote hosts
6
11
  # @param args (Hash) Send options
7
12
  def call(cases, args)
8
13
  threads = []
9
14
  puts ""
10
- puts Rainbow("-" * 50).green
11
- puts Rainbow("Sending files...#{args}").color(:green)
12
- cases.each { |c| threads << Thread.new { c.send(args) } }
15
+ write("-" * 70, :green)
16
+ write("Started at #{Time.new}", :green)
17
+ write("Sending reports to reachable hosts. Options=#{args}", :green)
18
+
19
+ cases.each { |c| threads << Thread.new { c.send(@logfile, args) } }
13
20
  threads.each(&:join)
14
- puts Rainbow("Sending finished!").color(:green)
15
- puts Rainbow("-" * 50).green
21
+
22
+ write("Finished!", :green)
23
+ puts Rainbow("-" * 70).green
24
+ end
25
+
26
+ private
27
+
28
+ def write(msg, color)
29
+ puts Rainbow(msg).color(color)
30
+ @logfile.write "#{msg}\n"
31
+ @logfile.flush
16
32
  end
17
33
  end
@@ -1,6 +1,5 @@
1
1
  require "rainbow"
2
2
  require "terminal-table"
3
- # require_relative "../utils/application"
4
3
  require_relative "../utils/project"
5
4
 
6
5
  # | Verbosity level | Description |
@@ -10,6 +10,7 @@ require_relative "result"
10
10
  class Readme
11
11
  include DSL
12
12
  include ReadmeDSL
13
+
13
14
  attr_reader :result
14
15
  attr_reader :data
15
16
 
@@ -35,6 +35,7 @@ module Formatter
35
35
  xml: XMLFormatter,
36
36
  yaml: YAMLFormatter,
37
37
  moodle_csv: MoodleCSVFormatter,
38
+ resume_colored_text: ResumeColoredTextFormatter,
38
39
  resume_html: ResumeHTMLFormatter,
39
40
  resume_json: ResumeJSONFormatter,
40
41
  resume_txt: ResumeTXTFormatter,
@@ -3,11 +3,7 @@ require_relative "../utils/settings"
3
3
  require_relative "formatter/formatter"
4
4
 
5
5
  class Report
6
- attr_accessor :id, :filename, :output_dir
7
- attr_accessor :head
8
- attr_accessor :lines
9
- attr_accessor :tail
10
- attr_accessor :format
6
+ attr_accessor :id, :filename, :output_dir, :head, :lines, :tail, :format
11
7
  attr_reader :history
12
8
 
13
9
  def initialize(id = "00")
@@ -63,9 +63,9 @@ class Project
63
63
  value[:config_path] = finder.config_path
64
64
  value[:test_name] = finder.test_name
65
65
 
66
- unless value[:options]["case"].nil?
67
- numbers = value[:options]["case"].split(",")
68
- value[:options]["case"] = numbers.collect!(&:to_i)
69
- end
66
+ return if value[:options]["case"].nil?
67
+
68
+ numbers = value[:options]["case"].split(",")
69
+ value[:options]["case"] = numbers.collect!(&:to_i)
70
70
  end
71
71
  end
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.9.5"
2
+ VERSION = "2.10.0"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.5
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rainbow
@@ -107,6 +107,34 @@ dependencies:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: '4.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: ed25519
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.2'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.2'
124
+ - !ruby/object:Gem::Dependency
125
+ name: bcrypt_pbkdf
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.0'
131
+ type: :runtime
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.0'
110
138
  description: |2
111
139
  Intrastructure test, useful for:
112
140
  (1) Sysadmin teachers to evaluate students remote machines.
@@ -121,15 +149,12 @@ executables:
121
149
  - teuton
122
150
  extensions: []
123
151
  extra_rdoc_files:
124
- - README.md
125
152
  - LICENSE
126
- - docs/changelog/changelog.1.md
127
- - docs/changelog/changelog.2.md
128
- - docs/changelog/todo.md
153
+ - README.md
129
154
  - docs/commands/README.md
130
- - docs/commands/example_check.md
131
- - docs/commands/example_run.md
132
- - docs/diagram.md
155
+ - docs/commands/check-example.md
156
+ - docs/commands/howto-run-tests.md
157
+ - docs/devel/diagram.md
133
158
  - docs/dsl/README.md
134
159
  - docs/dsl/expect.md
135
160
  - docs/dsl/export.md
@@ -153,11 +178,9 @@ extra_rdoc_files:
153
178
  - docs/ideas/servidor-de-retos.md
154
179
  - docs/ideas/todo.md
155
180
  - docs/install/README.md
156
- - docs/install/manual.md
157
181
  - docs/install/modes_of_use.md
158
182
  - docs/install/s-node.md
159
183
  - docs/install/t-node.md
160
- - docs/install/vagrant_docker.md
161
184
  - docs/learn/01-cmd_new.md
162
185
  - docs/learn/02-target.md
163
186
  - docs/learn/03-remote_hosts.md
@@ -192,13 +215,10 @@ files:
192
215
  - LICENSE
193
216
  - README.md
194
217
  - bin/teuton
195
- - docs/changelog/changelog.1.md
196
- - docs/changelog/changelog.2.md
197
- - docs/changelog/todo.md
198
218
  - docs/commands/README.md
199
- - docs/commands/example_check.md
200
- - docs/commands/example_run.md
201
- - docs/diagram.md
219
+ - docs/commands/check-example.md
220
+ - docs/commands/howto-run-tests.md
221
+ - docs/devel/diagram.md
202
222
  - docs/dsl/README.md
203
223
  - docs/dsl/expect.md
204
224
  - docs/dsl/export.md
@@ -222,11 +242,9 @@ files:
222
242
  - docs/ideas/servidor-de-retos.md
223
243
  - docs/ideas/todo.md
224
244
  - docs/install/README.md
225
- - docs/install/manual.md
226
245
  - docs/install/modes_of_use.md
227
246
  - docs/install/s-node.md
228
247
  - docs/install/t-node.md
229
- - docs/install/vagrant_docker.md
230
248
  - docs/learn/01-cmd_new.md
231
249
  - docs/learn/02-target.md
232
250
  - docs/learn/03-remote_hosts.md
@@ -312,10 +330,6 @@ files:
312
330
  - lib/teuton/check/main.rb
313
331
  - lib/teuton/check/show.rb
314
332
  - lib/teuton/cli.rb
315
- - lib/teuton/deprecated/application.rb
316
- - lib/teuton/deprecated/application_test.rb
317
- - lib/teuton/deprecated/runner.rb
318
- - lib/teuton/deprecated/utils.rb
319
333
  - lib/teuton/files/README.md
320
334
  - lib/teuton/files/config.yaml
321
335
  - lib/teuton/files/start.rb
@@ -372,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
386
  - !ruby/object:Gem::Version
373
387
  version: '0'
374
388
  requirements: []
375
- rubygems_version: 3.6.2
389
+ rubygems_version: 3.7.2
376
390
  specification_version: 4
377
391
  summary: Teuton (Infrastructure test)
378
392
  test_files: []
@@ -1,119 +0,0 @@
1
- [<< back](../CHANGELOG.md)
2
-
3
- # CHANGELOG
4
-
5
- ## [0.22.1] June 2017
6
-
7
- * Now it's posible to use config files with YAML and JSON format
8
- * Preparing migration of CLI command to use Thor gem
9
-
10
- ## [1.0.0] July 2017
11
-
12
- * New stable version
13
-
14
- ## 2019
15
-
16
- ## [1.10.0] Janyary 2019
17
-
18
- * SysadminGame change his name by TEUTON. "project" command replaced by "teuton".
19
- * Challenges (Teuton scripts) moved to "teuton-challenges" github repository.
20
- * Execute "rake get_challenges" to get sample teuton challenges
21
-
22
- ## [2.0.4] August 2019
23
-
24
- * TEUTON project grew up and was divided into the folowing repositories: teuton, challenges, panel, resources and vagrant.
25
- * Documentation has been moved into respository teuton wiki. Only maintain English docs.
26
-
27
- ## [2.1.0]
28
-
29
- **Export grades on csv file using Moodle format**
30
-
31
- * Automaticaly exports `moodle.csv` file with all cases grades, using adecuate format so it could be imported directly into Moodle platform.
32
- * We need to configure some params like this:
33
-
34
- ```
35
- ---
36
- :global:
37
- :cases:
38
- - :tt_members: ...
39
- :tt_moodle_id: User Moodle Identity
40
- ```
41
-
42
- **readme keyword**
43
-
44
- We currently use the "teuton readme pry-folder" command to export README file from the challenge.
45
-
46
- * This example shows how to use readme keyword to add group description or target description:
47
-
48
- ```
49
- group "GROUPNAME" do
50
- readme "Description for this group"
51
-
52
- target "target1"
53
- readme "Description for this target"
54
- goto :host, :exec => 'id root'
55
- expec_one 'root'
56
- ```
57
-
58
- **Installation process**
59
-
60
- * Use Bundler to install gems instead of rake.
61
- * It will be usefull use sysadming-game as gem? And install it with `gem install teuton`.
62
- * Vagrant: test how to use vagrant machines as case hosts.
63
-
64
- **Info sobre novedades de la versión 2.1**
65
-
66
- 1. Teuton readme y dsl readme
67
- 2. Macros de define macro
68
- 3. Export yaml y html
69
- 4. Teuton --no-color
70
- 5. teuton run --case
71
- 6. teuton run --cname
72
- 7. teuton run --cpath
73
- 8. actualizar formatos de salida
74
- 9. instalación mediante gemas
75
- 10. teuton panel
76
- 11. teuton client y server
77
- 12. nuevos nombres de comandos...
78
- 13. cambio de goto a run
79
-
80
- ## [2.2.0]
81
-
82
- **New features**
83
-
84
- * Let's see new features examples:
85
- * 10 result and moodle_id
86
- * 11 get_vars
87
- * 12 alias
88
- * 13 include (tt_include config param)
89
- * 14 macros
90
-
91
- **Configuration file**
92
-
93
- * Por defecto los valores de clave de los ficheros de configuración serán Strings en lugar de símbolos, aunque lo símbolos seguirán funcionando.
94
-
95
- **get_vars: To think - We are not sure about this***
96
-
97
- * "get" keyword simplification: Simplify getting and setting params process. For example: `_username_`, may be alias for `get(:username)`. Then
98
-
99
- ```
100
- target "Create user #{_username_}"
101
- run "id #{_username_}"
102
- expect_one _username_
103
- ```
104
- Same as
105
-
106
- ```
107
- target "Create user "+get(:username)
108
- run "id " + get(:username)
109
- expect_one get(:username)
110
- ```
111
-
112
- * Promocinar el proyecto:
113
- * Documentar y hacer videos.
114
- * Charlas y talleres
115
-
116
- **Fixed**
117
-
118
- * Solucionar fallo en --cname
119
- * Revisar doc options como cpanel
@@ -1,128 +0,0 @@
1
-
2
- ## [2.3.9]
3
-
4
- - FIX: Remove warnings from linter
5
- - FIX: Remove warning about thor gem version. Upgrade gem to 1.2
6
-
7
- ## [2.3.11]
8
-
9
- - Issue #18
10
-
11
- ## [2.4.0]
12
-
13
- New features:
14
- - Hide feedback from reports: `export feedback: false`
15
- - Add new DSL keyword: expect_last, expect_fisrt
16
- - Remove os gem.
17
- - Change test output colors to green as use others test tools.
18
- - Change show DSL params. Accepts one param "verbose: NUMBER" to adjust verbosity output level on screen.
19
-
20
- New doc and example:
21
- - 14-alias
22
- - 16-exit_codes
23
-
24
- Bug fixed:
25
- - All "expect*" keywords must require 2 arguments. The second is optional.
26
-
27
- Revise
28
- - Remove colors to log text
29
- - teuton readme: macros, getvars, expect_last, expect_first
30
-
31
- ## [2.4.2]
32
-
33
- - Fix bug with result.grep_v(Array)
34
-
35
- ## [2.4.3]
36
-
37
- - Fix: "expect_none" without params works as "expect result.count.eq 0"
38
- - Add: "expect_nothing" that works as "expect result.count.eq 0".
39
-
40
- ## [2.4.4]
41
-
42
- -- Modify: teuton check output colors and exit codes.
43
- exit code 0 = check OK
44
- exit code 1 = check error
45
- -- Fix teuton check docs.
46
-
47
- ## [2.4.5]
48
-
49
- -- FIX: "expect_nothing" was always TRUE when SSH/Telnet connections fails!
50
- Now when SSH/Telnet connections fails result contains "SSH: NO CONNECTION!"
51
- So "expect_nothing" will fail.
52
-
53
- ## [2.5.0]
54
-
55
- - ADD: "tt_moodle_max_score" global configuration param. Teuton grades (0-100) are divided by this value when exporting data into "moodle.csv" output file.
56
- - UPDATE: Revise documentation. Doc learn 10,11, 12,13 y 14. 10 result and moodle_id, 12 alias, 13 include, 14 macro, Doc tt_include
57
- - UPDATE: Internal changes. Remove Colorize gem and replace with Rainbow.
58
-
59
- ## [2.6.0]
60
-
61
- - [ADD] When running local or SSH commands, stdout and stderr are captured and readed by "expect" sentence.
62
-
63
- ## [2.7.0]
64
-
65
- New features:
66
- - [ADD] "teuton config PROJECTPATH" will suggest suitable configuration for the project.
67
- - [ADD] Every one line command output is registered into reports.
68
- - [ADD] "expect_exit 1", check last command exit code is equal to 1.
69
-
70
- Internal changes:
71
- * Application class splited into Settings and Project classes
72
- * Create SendManager similar to ExportManager
73
-
74
- ## [2.7.1]
75
-
76
- - [FIX] Fixed an issue that appeared when executing test and fail connection to remote computer.
77
-
78
- ## [2.7.2] 20230607
79
-
80
- - [FIX] Fixed an issue that appeared when exporting reports without feedback after failing to connect to remote computer.
81
-
82
- ## [2.7.3] 20230607
83
-
84
- - [FIX] Hall of fame now use Project class instead of Application.
85
-
86
- ## [2.8.0] 20230630
87
-
88
- DSL expect:
89
- - [ADD] "expect_ok" as "expect_exit 0 ".
90
- - [ADD] "expect_fail" as "expect_exit NUMBER" where NUMBER > 0.
91
- - [FIX] expect evaluation fail when there is no remote connection.
92
-
93
- DSL send:
94
- - [UPDATE] Rename "remote_dir" send param to "dir".
95
- - [UPDATE] send output messages
96
-
97
- ## [2.9.0] 20230726
98
-
99
- - [ADD] "expect_sequence" that check if sequence is present
100
- - [ADD] New DSL "run_script". Example: `run_script script, on: :host1`, upload script to host1 and then execute it on remote.
101
- - [ADD] New DSL "upload". Upload local file to remote host. Example `upload "localfile", to: :host1`
102
- - [ADD] `teuton check` works with `expect_sequence`, `run_script` and `upload`.
103
- - [FIX] `teuton check` works fine with `macros`.
104
- - [ADD] `teuton readme` works with `expect_sequence`, `run_script` and `upload`.
105
- - [FIX] `teuton readme` works fine with `macros`.
106
-
107
- ## [2.9.1] 20231117
108
-
109
- - [FIX] Config option `tt_include` doubled readed data on Windows platforms.
110
-
111
- ## [2.9.2] 20231201
112
-
113
- - [FIX] Change error message when running a non-existent challenge
114
- ```
115
- ❯ teuton run example/foo
116
- [ERROR] Cannot find main file!
117
- /home/username/example/foo/start.rb
118
- or /home/username/example/foo.rb
119
- ```
120
-
121
- ## [2.9.3] 20250402
122
-
123
- - [FIX] Error with telnet connections.
124
-
125
- ## [2.9.4] 20250410
126
-
127
- - [FIX] Improve the markdown output of the readme.
128
- - [FIX] Telnet exitcode
@@ -1,16 +0,0 @@
1
-
2
- ## TO-DO
3
-
4
- New features:
5
- - Teuton readme --lang=es and export files with other langs
6
- - Snode Dockerfile with SSH server
7
- - Auto Parse new input format, and detect parse errors
8
-
9
- Revise:
10
- * verify get(:key) and get('key') works fine!
11
- * Formatter: xml
12
-
13
- Internal changes:
14
- * Laboratory to Checker
15
- * Unify messages ERROR, INFO, WARN. etc
16
- * Add tt_label as alias of tt_members
@@ -1,41 +0,0 @@
1
- [<< back](README.md)
2
-
3
- # Teuton installation for developers
4
-
5
- There are diferents Teuton [Modes of use](Modes of use). For every mode there are 2 node types and every node has their own installation:
6
-
7
- * **T-node**: This host has installed Teuton software.
8
- * **S-node**: This host has installed SSH server.
9
-
10
- ---
11
- # T-NODE: Manual installation
12
-
13
- 1. Git installation
14
- * Install Git.
15
- * Run `git --version` to show current version
16
- 1. Ruby installation
17
- * Install ruby.
18
- * Run `ruby -v` to show current version (2.1.3p242+)
19
- 1. Rake installation
20
- * Run `gem install rake`, then
21
- * `rake --version` to show current version (10.4.2+).
22
- 1. Download this project
23
- * (a) `git clone https://github.com/dvarrui/teuton.git` or
24
- * (b) Download and unzip [file](https://github.com/dvarrui/teuton-panel/archive/master.zip).
25
- 1. Move into Teuton folder
26
- * Run `cd teuton`
27
- 1. Gems installation.
28
- * `rake install:gems`, to install required gems.
29
- 1. Only for developers
30
- * Run `rake install:debian` or
31
- * `rake install:opensuse`, install gem for developers.
32
- 1. Final check
33
- * `rake`
34
-
35
- ---
36
-
37
- # S-NODE: Manual installation
38
-
39
- * Install SSH server on your host.
40
-
41
- > How to [install SSH on Windows](s-node.md)
@@ -1,56 +0,0 @@
1
- [<< back](README.md)
2
-
3
- # Vagrant and Docker installation
4
-
5
- 1. Vagrant
6
- 2. Docker
7
-
8
- ---
9
- # 1. Install using Vagrant
10
-
11
- * First, install `Vagrant` and `VirtualBox` on your host.
12
- * Create directory for vagrant project. For example, `mkdir teuton-vagrant`.
13
- * Move into that directory: `cd teuton-vagrant`.
14
- * Choose and download [Vagrantfile](../../install/vagrant).
15
- * Run `vagrant up` to create your Virtual Machine.
16
-
17
- # 2. Install using Docker
18
-
19
- First:
20
- * Install `docker` on your host.
21
-
22
- Second, choose:
23
- * Pulling docker image from remote or
24
- * Rebuild local docker image.
25
-
26
- ## 2.1 Pulling docker images from remote
27
-
28
- Run this command to pull **dvarrui/teuton** image from Docker Hub and create "teuton" container:
29
-
30
- `docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`
31
-
32
- ## 2.2 Rebuild local docker image
33
-
34
- 1. Create Dockerfile like this:
35
-
36
- ```
37
- FROM debian:latest
38
-
39
- MAINTAINER teuton 2.1
40
-
41
- RUN apt-get update
42
- RUN apt-get install -y apt-utils
43
- RUN apt-get install -y vim tree
44
- RUN apt-get install -y ruby
45
- RUN gem install teuton
46
- RUN mkdir /home/teuton
47
-
48
- EXPOSE 80
49
-
50
- WORKDIR /home/teuton
51
- CMD ["/bin/bash"]
52
- ```
53
- 1. Build local docker image **dvarrui/teuton** with `docker build -t dvarrui/teuton .`
54
- 1. Create **teuton** container with `docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`.
55
-
56
- > Notice `/home/teuton` folder is persistent volume.
@@ -1,80 +0,0 @@
1
- require "singleton"
2
- require_relative "name_file_finder"
3
-
4
- class Application
5
- include Singleton
6
-
7
- attr_reader :letter
8
- attr_reader :running_basedir, :output_basedir
9
- attr_reader :default
10
- attr_accessor :options
11
- attr_accessor :verbose
12
- attr_accessor :global # Global configuration params
13
- attr_accessor :ialias # Internal alias
14
- attr_accessor :uses # Array of uses
15
- attr_accessor :project_path, :script_path, :config_path, :test_name
16
-
17
- def initialize
18
- reset
19
- end
20
-
21
- def reset
22
- @letter = {
23
- good: ".",
24
- bad: "F",
25
- error: "?",
26
- none: " ",
27
- ok: "\u{2714}",
28
- cross: "\u{2716}"
29
- }
30
- @running_basedir = Dir.getwd
31
- @output_basedir = "var"
32
- @default = {name: "teuton", format: :txt, debug: false}
33
- @options = {
34
- "lang" => "en",
35
- "color" => true,
36
- "panel" => false
37
- }
38
- @verbose = true
39
-
40
- @global = {}
41
- @ialias = {}
42
- @uses = [] # TODO
43
- end
44
-
45
- def debug
46
- @default[:debug]
47
- end
48
-
49
- def name
50
- @default[:name]
51
- end
52
-
53
- def quiet?
54
- return true if Application.instance.options["quiet"]
55
- return true unless Application.instance.verbose
56
-
57
- false
58
- end
59
-
60
- ##
61
- # Preprocess input options:
62
- # * Convert input case options String to an Array of integers
63
- # * Read color input option
64
- def add_input_params(projectpath, options)
65
- @options.merge! options
66
- Rainbow.enabled = @options["color"]
67
-
68
- finder = NameFileFinder.new(@options)
69
- finder.find_filenames_for(projectpath)
70
- @project_path = finder.project_path
71
- @script_path = finder.script_path
72
- @config_path = finder.config_path
73
- @test_name = finder.test_name
74
-
75
- unless @options["case"].nil?
76
- numbers = @options["case"].split(",")
77
- @options["case"] = numbers.collect!(&:to_i)
78
- end
79
- end
80
- end