teuton 2.4.5 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23e6309b8f112199998d8afd4517a06ec5b80ec4d68421ef67ef87b3c63684ef
4
- data.tar.gz: b0c17aefadc82be10bc1c52de45fdaa65f070046bc30bad7a0416803c62c5daf
3
+ metadata.gz: 8f53359ed5f8eae1b3a798630c5d56ae46076073bface7d3788de57b245a80cb
4
+ data.tar.gz: 366afd9ccee6db9bdf5756fe5954050231681763489bab11b1841e9279998c08
5
5
  SHA512:
6
- metadata.gz: dc3e324bb363b77302758a8210e02a6258d94e99c0797806c2e2f02894a970a6ca6977984abcc7cd647982c9752b7e5799c762684ca14131d06a1260ecb49eab
7
- data.tar.gz: b0bed729989027e9916b214b7421f88a172ef522197d1a5f589c2a5424f54688d5ea3695a3cded4410f2a68d63d5ef1687374b740b90ce91450558f03a1bcc37
6
+ metadata.gz: a40866560ec0d622b48322c0689dfe36cb9820cf565ce4258a8b71d38a1a3cc88e57f68e208c0d2a6c1a0787b7a2698af0446757bb2167fdf04d2bcd8002178f
7
+ data.tar.gz: 288e6105576a15ac25eb20d298bb552b77347b65a3a2df6632d0ef26063061c77c32ef02af88a6f7244790df9573b6e79d7e9fee8b0606006a41b0cd171a51c5
data/README.md CHANGED
@@ -3,21 +3,16 @@
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
5
5
  ![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
6
- ![Gem](https://img.shields.io/gem/dv/teuton/2.4.0)
7
6
 
8
7
  _Create Unit Test for your machines. Test your infrastructure as code._
9
8
 
10
9
  ![logo](./docs/images/logo.png)
11
10
 
12
- Teuton is an infrastructure test tool, useful for:
11
+ Infrastructure test, useful for:
13
12
  * Sysadmin teachers who want to evaluate students remote machines.
14
13
  * Sysadmin apprentices who want to evaluate their learning process as a game.
15
14
  * Professional sysadmin who want to monitor remote machines.
16
15
 
17
- Teuton allow us:
18
- * Write unit tests for real or virtual devices, using simple DSL.
19
- * Check compliance with requirements on local or remote devices.
20
-
21
16
  # Installation
22
17
 
23
18
  Install Ruby and then:
@@ -40,18 +35,19 @@ CASE RESULTS
40
35
  | CASE | MEMBERS | GRADE | STATE |
41
36
  | 01 | anonymous | 100.0 | ✔ |
42
37
  +------+-----------+-------+-------+
43
-
44
38
  ```
45
39
 
46
40
  # Features
47
41
 
48
- * [Free Software License](LICENSE).
42
+ * Simple DSL to define your tests: `target`, `run`,`expect` and more.
43
+ * Remote devices only require SSH or Telnet service installed.
44
+ * Output format: txt, html, json, yaml, etc.
49
45
  * Multiplatform.
50
- * Remote machines/devices only require SSH or Telnet service installed.
46
+ * [Free Software License](LICENSE).
51
47
 
52
48
  # Documentation
53
49
 
54
- * [Learn](docs/learn/README.md)
50
+ * [Getting started](docs/learn/README.md)
55
51
  * [Language reference](docs/dsl/README.md)
56
52
  * [Commands](docs/commands/README.md)
57
53
  * [Installation](docs/install/README.md)
@@ -10,18 +10,9 @@ Revise:
10
10
  * verify get(:key) and get('key') works fine!
11
11
  * Formatter: xml,
12
12
 
13
- Revise documentation:
14
- * Doc learn 10,11, 12,13 y 14
15
- * 10 result and moodle_id
16
- * 12 alias
17
- * 13 include
18
- * 14 macro
19
- * Doc tt_include
20
-
21
13
  Internal changes:
22
14
  * Application to Settings
23
15
  * Laboratory to Checker
24
- * Colorize to Rainbow
25
16
  * Unify messages ERROR, INFO, WARN. etc
26
17
  * Create SendManager as ExportManager?
27
18
  * Add tt_label as alias of tt_members
@@ -0,0 +1,6 @@
1
+
2
+ ## [2.5.0]
3
+
4
+ - 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.
5
+ - 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
6
+ - UPDATE: Internal changes. Remove Colorize gem and replace with Rainbow.
@@ -51,11 +51,10 @@ Example:
51
51
  :global:
52
52
  :cases:
53
53
  - :tt_members: VALUE
54
-
55
- Check OK!
56
54
  ```
57
55
 
58
56
  The check process notifies that
59
57
  * This test hasn't config file
60
58
  * and recommends content for our config file. But it isn't necessary for this example.
61
- * Syntax is OK!
59
+ * exit_code 0 = Syntax ok.
60
+ * exit code 1 = Syntax ERROR.
@@ -1,8 +1,8 @@
1
1
  [<< back](../../README.md)
2
2
 
3
- # Installation process
3
+ # Installation
4
4
 
5
- There are 2 types of nodes/hosts:
5
+ There are 2 types of nodes/hosts, so there are 2 installations:
6
6
 
7
7
  | ID | Software | Description |
8
8
  | -- | -------- | ----------- |
@@ -20,6 +20,7 @@ Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE
20
20
  | | Fedora | Workstation 29 | x84-64 | Ok | |
21
21
  | | LinuxMint | 18.3 | x86-64 | Ok | |
22
22
  | | openSUSE | Leap 15 | x86-64 | Ok | Ok |
23
+ | | openSUSE | Tumbleweed | x86-64 | Ok | Ok |
23
24
  | | Ubuntu | 18.04 | x86-64 | Ok | Ok |
24
25
  | Microsoft | Windows | 7 Enterprise | x86 | Ok | |
25
26
  | | Windows | 10 Pro | x86-64 | Ok | Ok |
@@ -8,7 +8,7 @@ Teuton generates a file called `moodle.csv` with the grades of each student into
8
8
 
9
9
  ## tt_moodle_id
10
10
 
11
- Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's identification (For example, the email registered on the Moodle, or ID number, etc.).
11
+ Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's Moodle identification. For example, registered email on or ID number on Moodle platform.
12
12
 
13
13
  Example:
14
14
 
@@ -21,4 +21,22 @@ cases:
21
21
  tt_moodle_id: obiwan@starwars.com
22
22
  ```
23
23
 
24
- Now, when running test "moodle.csv" will be generated with all student grades.
24
+ Now, when after test execution, use "moodle.csv" output file to load students grades and feedback into your Moodle platform.
25
+
26
+ ## tt_moodle_max_score
27
+
28
+ By default, teuton evaluates grades from 0 to 100. So grade max score is 100.0 by default. Sometimes teachers configure their moodle tasks with diferents max score, so it is necesary adjust Teuton output grades with Moodle input grades.
29
+
30
+ We use `tt_moodle_max_score` to customize Moodle max score. So when Teuton export `moodle.csv` values, divides Teuton grades by this value.
31
+
32
+ Example:
33
+
34
+ ```
35
+ global:
36
+ tt_moodle_max_score: 10
37
+ cases:
38
+ - tt_members: Darth Vader
39
+ tt_moodle_id: vader@starwars.com
40
+ - tt_members: Obiwan Kenobi
41
+ tt_moodle_id: obiwan@starwars.com
42
+ ```
@@ -70,9 +70,9 @@ class Application
70
70
  Rainbow.enabled = @options["color"]
71
71
  @options["panel"] = false if @options["panel"].nil?
72
72
 
73
- return if @options["case"].nil?
74
-
75
- a = @options["case"].split(",")
76
- @options["case"] = a.collect!(&:to_i)
73
+ unless @options["case"].nil?
74
+ numbers = @options["case"].split(",")
75
+ @options["case"] = numbers.collect!(&:to_i)
76
+ end
77
77
  end
78
78
  end
@@ -100,6 +100,9 @@ class Case
100
100
  end
101
101
  text = if @sessions[hostname].instance_of? Net::SSH::Connection::Session
102
102
  @sessions[hostname].exec!(@action[:command])
103
+ # ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
104
+ # stdout << data if stream == :stdout
105
+ # end
103
106
  else
104
107
  "SSH: NO CONNECTION!"
105
108
  end
@@ -16,7 +16,7 @@ class Laboratory
16
16
  revise_config_content
17
17
  end
18
18
 
19
- def show_panelconfig
19
+ def show_onlyconfig
20
20
  @verbose = false
21
21
  process_content
22
22
  @verbose = true
@@ -69,9 +69,9 @@ class Laboratory
69
69
  end
70
70
 
71
71
  def recomended_config_content
72
- verboseln Rainbow("[WARN] Configfile not found").bright.yellow
73
- verboseln Rainbow(" #{@path[:config]}").white
74
- verboseln Rainbow("[INFO] Recomended content:").bright.yellow
72
+ warn Rainbow("[WARN] Configfile not found").bright.yellow
73
+ warn Rainbow(" #{@path[:config]}").white
74
+ warn Rainbow("[INFO] Recomended content:").bright.yellow
75
75
  output = {global: nil, cases: []}
76
76
  output[:cases][0] = {}
77
77
  script_vars = find_script_vars
@@ -80,18 +80,14 @@ class Laboratory
80
80
  end
81
81
 
82
82
  def recomended_panelconfig_content
83
- output = {global: {}, cases: nil}
83
+ output = {global: nil, cases: [{}]}
84
84
  script_vars = find_script_vars
85
- script_vars.each { |i| output[:global][i] = "VALUE" }
85
+ # script_vars.each { |i| output[:global][i] = "VALUE" }
86
+ script_vars.each { |i| output[:cases][0][i] = "VALUE" }
86
87
  verboseln YAML.dump(output)
87
88
  end
88
89
 
89
90
  def revise_config_content
90
- my_screen_table = Terminal::Table.new do |st|
91
- st.add_row ["Revising CONFIG file"]
92
- end
93
- verboseln my_screen_table
94
-
95
91
  unless File.exist?(@path[:config])
96
92
  recomended_config_content
97
93
  return
data/lib/teuton/cli.rb CHANGED
@@ -15,7 +15,8 @@ class CLI < Thor
15
15
  end
16
16
 
17
17
  map ["c", "-c", "--check"] => "check"
18
- option :panelconfig, type: :boolean
18
+ option :onlyconfig, type: :boolean
19
+ option :color, type: :boolean
19
20
  option :cname, type: :string
20
21
  option :cpath, type: :string
21
22
  desc "check [OPTIONS] DIRECTORY", "Check test and config file content"
@@ -25,7 +26,7 @@ class CLI < Thor
25
26
 
26
27
  (2) teuton check PATH/TO/DIR --cname=demo , Check content of start.rb and demo.yaml files:
27
28
 
28
- (3) teuton check PATH/TO/DIR --panelconfig , Only show config file recomendations
29
+ (3) teuton check PATH/TO/DIR --onlyconfig , Only show config file recomendations
29
30
 
30
31
  (4) teuton check PATH/TO/DIR/foo.rb , Check content of foo.rb and foo.yaml files.
31
32
 
@@ -16,13 +16,18 @@ class MoodleCSVFormatter < ResumeArrayFormatter
16
16
  private
17
17
 
18
18
  def process_cases
19
+ max = @data[:config][:tt_moodle_max_score] || 100.0
20
+ grade_adjust = max.to_f / 100.0
19
21
  # MoodleID, Grade, Feedback
20
22
  w "MoodleID, TeutonGrade, TeutonFeedback\n"
21
23
  @data[:cases].each do |line|
22
24
  moodle_id = line[:moodle_id]
23
25
  moodle_id = line[:moodle_id].split(",") if moodle_id.instance_of? String
24
26
  moodle_id.each do |id|
25
- w "#{id.strip},#{line[:grade]},#{line[:moodle_feedback]}\n" unless line[:skip]
27
+ unless line[:skip]
28
+ grade = line[:grade].to_f * grade_adjust
29
+ w "#{id.strip},#{grade},#{line[:moodle_feedback]}\n"
30
+ end
26
31
  end
27
32
  end
28
33
  end
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.4.5"
2
+ VERSION = "2.5.0"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
data/lib/teuton.rb CHANGED
@@ -27,13 +27,11 @@ module Teuton
27
27
 
28
28
  app = Application.instance
29
29
  lab = Laboratory.new(app.script_path, app.config_path)
30
- if options[:panelconfig]
31
- lab.show_panelconfig
30
+ if options[:onlyconfig]
31
+ lab.show_onlyconfig
32
32
  else
33
33
  lab.show
34
34
  end
35
- puts Rainbow("Check OK!").green
36
- exit 0
37
35
  end
38
36
 
39
37
  private_class_method def self.require_dsl_and_script(dslpath)
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.5
4
+ version: 2.5.0
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-02-24 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -131,6 +131,7 @@ extra_rdoc_files:
131
131
  - docs/changelog/v2.2.md
132
132
  - docs/changelog/v2.3.md
133
133
  - docs/changelog/v2.4.md
134
+ - docs/changelog/v2.5.md
134
135
  - docs/changelog/version2.1.md
135
136
  - docs/commands/README.md
136
137
  - docs/commands/example_check.md
@@ -197,6 +198,7 @@ files:
197
198
  - docs/changelog/v2.2.md
198
199
  - docs/changelog/v2.3.md
199
200
  - docs/changelog/v2.4.md
201
+ - docs/changelog/v2.5.md
200
202
  - docs/changelog/version2.1.md
201
203
  - docs/commands/README.md
202
204
  - docs/commands/example_check.md