teuton 2.3.8 → 2.3.10

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: '0873f32e05d17fdf4c3903594c5e7fa63746afe919b186900ca5e123358ebb08'
4
- data.tar.gz: fba17dd71e723d555eeca03a671cb2b171a00b4c874d763325e0dd5921162da4
3
+ metadata.gz: ba8dbeaec5863f4d60b6853aca32cfce221b2ac27aca80d268fff111f23095b7
4
+ data.tar.gz: 450bf428d168aaa7368cc75856008104eab18a19f6303523c9725f35b65a7afe
5
5
  SHA512:
6
- metadata.gz: e05506134ae1dc7a4a64b0c519221a466c35ac50b15770bde019cae780f940d244ba522f5a8932791c415ab37e0530741c5f9f894320b148be417a62d2a8dced
7
- data.tar.gz: 40b76d2fb4de366748e261eb5d8350038ed3bdc7d5d2c2d63c2ce3f81b86886dcd39686c911e75c331c090ddeaadf383136509ed8e3e73b9ff9513265ca0d5f4
6
+ metadata.gz: 839450ffcf8c53be3c9ab21d4ecc1957fcac7a18abf13d790b810501120a4764084c415e718c711a7f7500b538d70441f754450fa8d6730718b6f1b372ed50f6
7
+ data.tar.gz: 7bb2ba86ade115df17aff814176b19011f2a97eefc37494869ec87aa59c7a4d4b2909f4f2fd44fcdb81b15c7de465a72fbc9ed0898e8cc7b0addd54975a7f01e
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
 
2
2
  [![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
3
3
  ![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
4
- ![Gem](https://img.shields.io/gem/dv/teuton/2.3.7)
4
+ ![Gem](https://img.shields.io/gem/dv/teuton/2.3.8)
5
5
 
6
6
  # TEUTON
7
7
 
8
- _Create Unit Test for your machines, and
9
- test your infraestructure as code._
8
+ _Create Unit Test for your machines. Test your infraestructure as code._
10
9
 
11
10
  ![logo](./docs/images/logo.png)
12
11
 
@@ -24,7 +23,7 @@ Teuton allow us:
24
23
  * [Installation](https://github.com/teuton-software/teuton/tree/master/docs/install/README.md)
25
24
  * Install Ruby on your system.
26
25
  * Install Teuton as normal user: `gem install --user-install teuton` (or install as superuser `gem install teuton`).
27
- * [Videos, blogs, news](docs/videos.md)
26
+ * [Blogs and videos](docs/videos.md)
28
27
  * [Learning](docs/learn/README.md)
29
28
  * [Commands](docs/commands/README.md)
30
29
  * [Language reference](docs/dsl/README.md)
data/docs/CHANGELOG.md CHANGED
@@ -2,7 +2,20 @@
2
2
 
3
3
  # Changelog
4
4
 
5
- * [version 2.4](changelog/v2.4.md)
5
+ * [version 2.3](changelog/v2.3.md)
6
6
  * [version 2.2](changelog/v2.2.md)
7
7
  * [version 2.1](changelog/v2.1.md)
8
8
  * [version 2.0](changelog/v2.0.md)
9
+
10
+ ## TO-DO
11
+
12
+ - Teuton readme --lang=es
13
+
14
+ Revise documentation:
15
+ * Doc learn 10,11, 12,13 y 14
16
+ * 10 result and moodle_id
17
+ * 11 get_vars
18
+ * 12 alias
19
+ * 13 include
20
+ * 14 macro
21
+ * Doc tt_include
@@ -1,3 +1,4 @@
1
+ [<< back](../CHANGELOG.md)
1
2
 
2
3
  # CHANGELOG
3
4
 
@@ -1,3 +1,4 @@
1
+ [<< back](../CHANGELOG.md)
1
2
 
2
3
  # CHANGELOG teuton v 2.1
3
4
 
@@ -1,3 +1,4 @@
1
+ [<< back](../CHANGELOG.md)
1
2
 
2
3
  # Teuton (version 2.2)
3
4
 
@@ -39,15 +40,3 @@ expect_one get(:username)
39
40
 
40
41
  * Solucionar fallo en --cname
41
42
  * Revisar doc options como cpanel
42
-
43
- ## TODO
44
-
45
- **Documentation**
46
-
47
- * Doc learn 10,11, 12,13 y 14
48
- * 10 result and moodle_id
49
- * 11 get_vars
50
- * 12 alias
51
- * 13 include
52
- * 14 macro
53
- * Doc tt_include
@@ -0,0 +1,6 @@
1
+
2
+ ## [2.3.9]
3
+
4
+ Bug fixed:
5
+ - Remove warnings from linter
6
+ - Remove warning about thor gem version. Upgrade gem to 1.2
data/docs/videos.md CHANGED
@@ -1,19 +1,20 @@
1
1
  [<< back](../README.md)
2
2
 
3
- # News
3
+ # Blogs
4
4
 
5
- * [Introducción a Teuton](https://elpuig.xeill.net/Members/vcarceler/articulos/introduccion-a-teuton): iniciarse en el uso de Teutón gracias al fantástico artículo de Víctor Carceler.
6
- * [Verificar prácticas de GNS3 con Teuton](https://elpuig.xeill.net/Members/juanmorote/articulos/verificar-practicas-de-gns3-con-teuton): GNS3 es un excelente simulador de red Open Source que además se entiende con Teuton a las mil maravillas.
5
+ * ES - [Introducción a Teuton](https://elpuig.xeill.net/Members/vcarceler/articulos/introduccion-a-teuton): iniciarse en el uso de Teutón gracias al fantástico artículo de Víctor Carceler.
6
+ * ES - [Verificar prácticas de GNS3 con Teuton](https://elpuig.xeill.net/Members/juanmorote/articulos/verificar-practicas-de-gns3-con-teuton): GNS3 es un excelente simulador de red Open Source que además se entiende con Teuton a las mil maravillas.
7
7
 
8
8
  # Videos
9
9
 
10
+ Teuton:
11
+ * [Apuntes FP Informática - I Congreso Virtual - Mayo 2020](https://youtu.be/RxIV26BAoGo)
12
+ * [Teuton Software 2.1 - Tutorial - Oct 2020](https://youtu.be/cyBN-rOYQeY)
13
+
10
14
  Teuton en el 2016 se llamaba "sysadmingame".
11
- * [CHAPI16 - Presentación sysadmingame chapi16 - Abril 2016](https://youtu.be/cNJaB5xzHHQ)
15
+ * ES -[CHAPI16 - Presentación sysadmingame chapi16 - Abril 2016](https://youtu.be/cNJaB5xzHHQ)
12
16
  * sysadmingame:
13
17
  1. [Instalación del programa](https://youtu.be/dnyMq9_KDco)
14
18
  2. [Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
15
19
  3. [Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
16
20
 
17
- Teuton:
18
- * [Apuntes FP Informática - I Congreso Virtual - Mayo 2020](https://youtu.be/RxIV26BAoGo)
19
- * [Teuton Software 2.1 - Tutorial - Oct 2020](https://youtu.be/cyBN-rOYQeY)
@@ -76,46 +76,30 @@ class Case
76
76
  tempfile :default
77
77
  end
78
78
 
79
- ##
80
- # Export Case with specific output format
81
- # @param format (Symbol)
82
79
  def export(format)
83
80
  return if skip?
84
81
 
85
82
  @report.export format
86
83
  end
87
84
 
88
- ##
89
- # Return case report filename
90
- # @return String
91
85
  def filename
92
86
  @report.filename
93
87
  end
94
88
 
95
- ##
96
- # Return case grade
97
- # @return grade
98
89
  def grade
99
90
  return 0.0 if skip
100
91
 
101
92
  @report.tail[:grade]
102
93
  end
103
94
 
104
- ## Return case members
105
- # @return members
106
95
  def members
107
96
  return "-" if skip
108
97
 
109
98
  @report.head[:tt_members] || "noname"
110
99
  end
111
100
 
112
- ##
113
- # Return case skip value
114
- # @return skip
115
101
  alias skip? skip
116
102
 
117
- ##
118
- # Show case report data on screen
119
103
  def show
120
104
  @report.show
121
105
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Class Case#close
4
3
  class Case
5
4
  def close(uniques)
6
5
  fails = 0
@@ -7,8 +7,6 @@
7
7
  # * fill_report
8
8
  # * close_opened_sessions
9
9
  class Case
10
- ##
11
- # Execute "play" order on this case
12
10
  def play
13
11
  if skip?
14
12
  verbose "Skipping case <#{@config.get(:tt_members)}>\n"
@@ -34,9 +32,6 @@ class Case
34
32
 
35
33
  private
36
34
 
37
- ##
38
- # Execute every play#group in parallel
39
- # TO-DO: Under construction!
40
35
  def play_in_parallel
41
36
  @groups.each do |t|
42
37
  @action[:groupname] = t[:name]
@@ -44,8 +39,6 @@ class Case
44
39
  end
45
40
  end
46
41
 
47
- ##
48
- # Execute every play#group in sequence
49
42
  def play_in_sequence
50
43
  verboseln "Starting case [#{@config.get(:tt_members)}]"
51
44
  @groups.each do |t|
@@ -57,8 +50,6 @@ class Case
57
50
  verboseln "\n"
58
51
  end
59
52
 
60
- ##
61
- # Fill case report with time information
62
53
  def fill_report(start_time, finish_time)
63
54
  @report.head.merge! @config.global
64
55
  @report.head.merge! @config.local
@@ -1,8 +1,6 @@
1
1
  require_relative "../application"
2
2
  require_relative "case_manager"
3
3
 
4
- # Define filename to be used into our test
5
- # @param filename (String) Filename to be required
6
4
  def use(filename)
7
5
  filename += ".rb"
8
6
  app = Application.instance
@@ -14,9 +12,6 @@ def use(filename)
14
12
  app.uses << File.basename(findfiles.first)
15
13
  end
16
14
 
17
- # Define macro. That's a name to predefined target-run-expect evaluation.
18
- # @param name (String) macro name
19
- # @param block (Block) macro code
20
15
  def define_macro(name, *args, &block)
21
16
  Application.instance.macros[name] = {args: args, block: block}
22
17
  end
@@ -3,14 +3,10 @@
3
3
  ##
4
4
  # Include Teuton DSL keywords into Laboratory class
5
5
  class Laboratory
6
- ##
7
- # Execute Teuton DSL readme keyword
8
6
  def readme(_text)
9
7
  # Usefull for "teuton readme" command action.
10
8
  end
11
9
 
12
- ##
13
- # Execute Teuton DSL target keyword
14
10
  def target(desc, args = {})
15
11
  @stats[:targets] += 1
16
12
  @targetid += 1
@@ -20,55 +16,36 @@ class Laboratory
20
16
  end
21
17
  alias goal target
22
18
 
23
- ##
24
- # Execute Teuton DSL run keyword
25
- def run(command, args = {})
26
- args[:exec] = command
27
- host = :localhost
28
- host = args[:on] if args[:on]
29
- goto(host, args)
30
- end
31
-
32
- ##
33
- # Execute Teuton DSL goto keyword
34
- def goto(host = :localhost, args = {})
35
- result.reset
36
- args[:on] = host unless args[:on]
37
-
38
- if @hosts[host]
39
- @hosts[host] += 1
40
- else
41
- @hosts[host] = 1
42
- end
43
- verboseln " run '#{args[:exec]}' on #{args[:on]}"
44
- end
45
-
46
- ##
47
- # Execute Teuton DSL expect keyword
48
19
  def expect(cond)
49
20
  verboseln " alter #{result.alterations}" unless result.alterations.empty?
50
21
  verboseln " expect #{cond} (#{cond.class})"
51
22
  verboseln ""
52
23
  end
53
24
 
54
- ##
55
- # Execute Teuton DSL expect_one keyword
56
- def expect_one(cond)
57
- verboseln " alter #{result.alterations}" unless result.alterations.empty?
58
- verboseln " expect_one #{cond} (#{cond.class})"
25
+ def expect_first(cond)
26
+ verboseln " alter #{result.alterations}" unless result.alterations.empty?
27
+ verboseln " expect_first #{cond} (#{cond.class})"
28
+ verboseln ""
29
+ end
30
+
31
+ def expect_last(cond)
32
+ verboseln " alter #{result.alterations}" unless result.alterations.empty?
33
+ verboseln " expect_last #{cond} (#{cond.class})"
59
34
  verboseln ""
60
35
  end
61
36
 
62
- ##
63
- # Execute Teuton DSL expect_none keyword
64
37
  def expect_none(cond)
65
38
  verboseln " alter #{result.alterations}" unless result.alterations.empty?
66
39
  verboseln " expect_none #{cond} (#{cond.class})"
67
40
  verboseln ""
68
41
  end
69
42
 
70
- ##
71
- # Execute Teuton DSL get keyword
43
+ def expect_one(cond)
44
+ verboseln " alter #{result.alterations}" unless result.alterations.empty?
45
+ verboseln " expect_one #{cond} (#{cond.class})"
46
+ verboseln ""
47
+ end
48
+
72
49
  def get(varname)
73
50
  @stats[:gets] += 1
74
51
 
@@ -81,23 +58,37 @@ class Laboratory
81
58
  "get(#{varname})"
82
59
  end
83
60
 
84
- # If a method call is missing, then try to call get(var)
85
- # rubocop:disable Style/MissingRespondToMissing
86
- def method_missing(method)
61
+ def run(command, args = {})
62
+ args[:exec] = command
63
+ host = :localhost
64
+ host = args[:on] if args[:on]
65
+ goto(host, args)
66
+ end
67
+
68
+ def goto(host = :localhost, args = {})
69
+ result.reset
70
+ args[:on] = host unless args[:on]
71
+
72
+ if @hosts[host]
73
+ @hosts[host] += 1
74
+ else
75
+ @hosts[host] = 1
76
+ end
77
+ verboseln " run '#{args[:exec]}' on #{args[:on]}"
78
+ end
79
+
80
+ # Check macros and _get_vars
81
+ def method_missing(method, *args, &block)
87
82
  a = method.to_s
88
- instance_eval("get(:#{a[0, a.size - 1]})", __FILE__, __LINE__) if a[a.size - 1] == "?"
83
+ if args.nil? && block.nil?
84
+ instance_eval("get(:#{a[0, a.size - 1]})", __FILE__, __LINE__) if a[a.size - 1] == "?"
85
+ end
89
86
  end
90
- # rubocop:enable Style/MissingRespondToMissing
91
87
 
92
- ##
93
- # Execute Teuton DSL gett keyword
94
- # Same as get keyword, but show pretty output when used by readme command.
95
88
  def gett(option)
96
89
  get(option)
97
90
  end
98
91
 
99
- ##
100
- # Execute Teuton DSL unique keyword
101
92
  def unique(key, _value)
102
93
  @stats[:uniques] += 1
103
94
 
@@ -105,15 +96,11 @@ class Laboratory
105
96
  verboseln ""
106
97
  end
107
98
 
108
- ##
109
- # Execute Teuton DSL log keyword
110
99
  def log(text = "", type = :info)
111
100
  @stats[:logs] += 1
112
101
  verboseln " log [#{type}]: " + text.to_s
113
102
  end
114
103
 
115
- ##
116
- # Execute Teuton DSL set keyword
117
104
  def set(key, value)
118
105
  @stats[:sets] += 1
119
106
 
@@ -6,9 +6,6 @@ require_relative "show"
6
6
  require_relative "dsl"
7
7
  require_relative "builtin"
8
8
 
9
- ##
10
- # DSL use: import filename instructions
11
- # @param filename (String)
12
9
  def use(filename)
13
10
  filename += ".rb"
14
11
  app = Application.instance
@@ -19,18 +16,18 @@ def use(filename)
19
16
  require_relative use[0]
20
17
  end
21
18
 
22
- ##
23
- # DSL group: Define a group of test
24
- # @param name (String or Symbol)
25
- # @param block (Proc)
26
19
  def group(name, &block)
27
20
  Application.instance.groups << {name: name, block: block}
28
21
  end
29
22
  alias task group
30
23
 
31
- ##
32
- # DSL start: Define main teuton test execution
33
- # @param block (Proc)
24
+ def define_macro(name, *args, &block)
25
+ Application.instance.macros[name] = {args: args, block: block}
26
+ end
27
+ alias def_macro define_macro
28
+ alias defmacro define_macro
29
+
30
+
34
31
  def start(&block)
35
32
  # Don't do nothing. We are checking test not running it
36
33
  end
@@ -9,8 +9,6 @@ require_relative "../utils/configfile_reader"
9
9
  # * show_stats
10
10
  # * show_config
11
11
  class Laboratory
12
- ##
13
- # Display DSL checking on screen
14
12
  def show
15
13
  @verbose = true
16
14
  process_content
@@ -18,8 +16,6 @@ class Laboratory
18
16
  revise_config_content
19
17
  end
20
18
 
21
- ##
22
- # Display config for teuton panel on screen
23
19
  def show_panelconfig
24
20
  @verbose = false
25
21
  process_content
@@ -104,12 +100,8 @@ class Laboratory
104
100
 
105
101
  script_vars = find_script_vars
106
102
  config_vars = ConfigFileReader.read(@path[:config])
107
- unless config_vars[:global].nil?
108
- config_vars[:global].each_key { |k| script_vars.delete(k) }
109
- end
110
- unless config_vars[:alias].nil?
111
- config_vars[:alias].each_key { |k| script_vars.delete(k) }
112
- end
103
+ config_vars[:global]&.each_key { |k| script_vars.delete(k) }
104
+ config_vars[:alias]&.each_key { |k| script_vars.delete(k) }
113
105
 
114
106
  config_vars[:cases].each_with_index do |item, index|
115
107
  next if item[:tt_skip] == true
@@ -69,6 +69,8 @@ class Readme
69
69
  result.reset
70
70
  end
71
71
  alias expect_any expect
72
+ alias expect_first expect
73
+ alias expect_last expect
72
74
  alias expect_none expect
73
75
  alias expect_one expect
74
76
 
@@ -7,9 +7,9 @@ module Lang
7
7
  version: "Teuton version : %s",
8
8
  testname: "Test unit name : %s",
9
9
  date: "Date : %s",
10
- hosts: "\n\#\#\# Required hosts\n",
11
- params: "\n\#\#\# Required params\n",
12
- goto: "\nGo to [%s](\#required-hosts) host, and do next:\n",
10
+ hosts: "\n### Required hosts\n",
11
+ params: "\n### Required params\n",
12
+ goto: "\nGo to [%s](#required-hosts) host, and do next:\n",
13
13
  global: "\nGlobal parameters that can be modified:\n",
14
14
  created: "\nParams created during challenge execution:\n"
15
15
  }
@@ -17,9 +17,9 @@ module Lang
17
17
  version: "Versión de Teuton : %s",
18
18
  testname: "Nombre del test : %s",
19
19
  date: "Fecha : %s",
20
- hosts: "\n\#\#\# Máquinas que se necesitan\n",
21
- params: "\n\#\#\# Parámetros de necesarios\n",
22
- goto: "\nIr a la máquina [%s](\#required-hosts), y hacer lo siguiente:\n",
20
+ hosts: "\n### Máquinas que se necesitan\n",
21
+ params: "\n### Parámetros de necesarios\n",
22
+ goto: "\nIr a la máquina [%s](#required-hosts), y hacer lo siguiente:\n",
23
23
  global: "\nParámetros globales que pueden ser modificados:\n",
24
24
  created: "\nParámetros creados durante la ejecución del reto:\n"
25
25
  }
@@ -144,13 +144,13 @@ class Readme
144
144
 
145
145
  puts "\n---"
146
146
  puts "# ANEXO"
147
- puts "\n\#\# Global params"
147
+ puts "\n## Global params"
148
148
  puts Lang.get(:global)
149
149
  puts "\n"
150
150
  puts "| Global param | Value |"
151
151
  puts "| --- | --- |"
152
152
  @global_params.each_pair { |k, v| puts "|#{k}|#{v}|" }
153
- puts "\n\#\# Created params"
153
+ puts "\n## Created params"
154
154
  puts Lang.get(:created)
155
155
  puts "\n"
156
156
  puts "| Created params | Value |"
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.3.8"
2
+ VERSION = "2.3.10"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
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.3.8
4
+ version: 2.3.10
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: 2022-10-22 00:00:00.000000000 Z
11
+ date: 2022-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.20'
103
+ version: '1.2'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.20'
110
+ version: '1.2'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: terminal-table
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +122,6 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.8'
125
- - !ruby/object:Gem::Dependency
126
- name: minitest
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '5.15'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '5.15'
139
125
  description: |2
140
126
  Intrastructure test, useful for:
141
127
  (1) Sysadmin teachers to evaluate students remote machines.
@@ -156,6 +142,7 @@ extra_rdoc_files:
156
142
  - docs/changelog/v2.0.md
157
143
  - docs/changelog/v2.1.md
158
144
  - docs/changelog/v2.2.md
145
+ - docs/changelog/v2.3.md
159
146
  - docs/changelog/v2.4.md
160
147
  - docs/changelog/version2.1.md
161
148
  - docs/commands/README.md
@@ -211,6 +198,7 @@ files:
211
198
  - docs/changelog/v2.0.md
212
199
  - docs/changelog/v2.1.md
213
200
  - docs/changelog/v2.2.md
201
+ - docs/changelog/v2.3.md
214
202
  - docs/changelog/v2.4.md
215
203
  - docs/changelog/version2.1.md
216
204
  - docs/commands/README.md
@@ -351,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
339
  - !ruby/object:Gem::Version
352
340
  version: '0'
353
341
  requirements: []
354
- rubygems_version: 3.3.3
342
+ rubygems_version: 3.3.26
355
343
  signing_key:
356
344
  specification_version: 4
357
345
  summary: Teuton (Infrastructure test)