teuton 2.3.2 → 2.3.5

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: 73bcbde38fc10f9c95d3ff64be195fa1edd2969faa9ffc27daf97f9e33c2f2a0
4
- data.tar.gz: b5ee720adb7e12cc6d95d2e6a157242992cc0cf459ffc85ad2e595e769ce26a2
3
+ metadata.gz: 0a36bf6988e2ba265f20e42f586c03272e151403c9f6d721d239cb0eb47f5aed
4
+ data.tar.gz: bbc005ffac1751e856d6ba0f4b07c1f6e7685e8028204f602636c3e9a17eb306
5
5
  SHA512:
6
- metadata.gz: e670cbdaa78cca6e0ab16a71cbdff3c5668010856f361f4db0812cbc2f638f4f3855a87488ca538a84687389ccdf739f9cee7f3a48e864e72967e9034b37b8d1
7
- data.tar.gz: f0701cb02f7ed5210f802c51e9f81d18ad4b526f511fd665004bc74d3b8a34a41907b3f6a16b3f25d64554c550c6f1693a6e6a65d381411c1b9225c42dc3ad5a
6
+ metadata.gz: 9b252bdd093780d5fec237d70f20545303c97d86bc9afa70957a5b1863b772cd69b1018b1e33f685ceb7e8537fc48197d14d64e445ecca071061a18a59d43e01
7
+ data.tar.gz: 3bfb33b02b0ce7d8507cc479250f2f3fc40173d7eeeb9d8377ff50c84e781c25fa4d842a06fa1b35981ca65cab990eccefb3955506ecce77e72106c29ac3946e
@@ -78,7 +78,6 @@ CASES
78
78
  | 02 | Student-name-2 | 0 | ? |
79
79
  +------+----------------+-------+-------+
80
80
 
81
-
82
81
  RESULTS
83
82
  +-------------+---------------------------+
84
83
  | start_time | 2020-10-10 12:37:54 +0100 |
@@ -22,15 +22,10 @@ class Application
22
22
  attr_accessor :hall_of_fame
23
23
  attr_accessor :project_path, :script_path, :config_path, :test_name
24
24
 
25
- ##
26
- # Initialize Application instance
27
25
  def initialize
28
26
  reset
29
27
  end
30
28
 
31
- ##
32
- # Reset param values
33
- # rubocop:disable Metrics/MethodLength
34
29
  def reset
35
30
  @letter = { good: '.', bad: 'F', error: '?', none: ' ' }
36
31
  @running_basedir = Dir.getwd
@@ -46,25 +41,15 @@ class Application
46
41
  @uses = [] # TODO
47
42
  @hall_of_fame = []
48
43
  end
49
- # rubocop:enable Metrics/MethodLength
50
44
 
51
- ##
52
- # Return debug param
53
- # @return Boolean
54
45
  def debug
55
46
  @default[:debug]
56
47
  end
57
48
 
58
- ##
59
- # Return name param
60
- # @return String
61
49
  def name
62
50
  @default[:name]
63
51
  end
64
52
 
65
- ##
66
- # Return quiet param
67
- # @return Boolean
68
53
  def quiet?
69
54
  return true if Application.instance.options['quiet']
70
55
  return true unless Application.instance.verbose
@@ -76,7 +61,6 @@ class Application
76
61
  # Preprocess input options:
77
62
  # * Convert input case options String to an Array of integers
78
63
  # * Read color input option
79
- # rubocop:disable Metrics/AbcSize
80
64
  def add_input_params(projectpath, options)
81
65
  @options.merge! options
82
66
  NameFileFinder.find_filenames_for(projectpath)
@@ -89,5 +73,4 @@ class Application
89
73
  a = @options['case'].split(',')
90
74
  @options['case'] = a.collect!(&:to_i)
91
75
  end
92
- # rubocop:enable Metrics/AbcSize
93
76
  end
@@ -18,7 +18,8 @@ module DSL
18
18
  ip = get((host + '_ip').to_sym)
19
19
  username = get((host + '_username').to_sym).to_s
20
20
  password = get((host + '_password').to_sym).to_s
21
- port = get((host + '_port').to_sym) || 22
21
+ port = get((host + '_port').to_sym).to_i
22
+ port = 22 if port.zero?
22
23
 
23
24
  filename = @report.filename + '.' + @report.format.to_s
24
25
  localfilepath = File.join(@report.output_dir, filename)
@@ -16,15 +16,16 @@ class Case
16
16
  end
17
17
  # TODO: Delete old reports???
18
18
  start_time = Time.now
19
- play_in_sequence if get(:tt_sequence) == true # Play in sequence
20
- play_in_parallel if get(:tt_sequence) != true # Play in parallel
19
+ if get(:tt_sequence) == true
20
+ play_in_sequence
21
+ else
22
+ play_in_parallel
23
+ end
21
24
  fill_report(start_time, Time.now)
22
25
  close_opened_sessions
23
26
  end
24
27
  alias start play
25
28
 
26
- ##
27
- # Close opened sessions for this case
28
29
  def close_opened_sessions
29
30
  @sessions.each_value do |s|
30
31
  s.close if s.class == Net::SSH::Connection::Session
@@ -46,9 +47,9 @@ class Case
46
47
  ##
47
48
  # Execute every play#group in sequence
48
49
  def play_in_sequence
49
- verboseln "Starting case <#{@config.get(:tt_members)}>"
50
+ verboseln "Starting case [#{@config.get(:tt_members)}]"
50
51
  @groups.each do |t|
51
- verbose "* Processing <#{t[:name]}> "
52
+ verbose "* Processing [#{t[:name]}] "
52
53
  @action[:groupname] = t[:name]
53
54
  instance_eval(&t[:block])
54
55
  verbose "\n"
@@ -58,7 +59,6 @@ class Case
58
59
 
59
60
  ##
60
61
  # Fill case report with time information
61
- # rubocop:disable Metrics/AbcSize
62
62
  def fill_report(start_time, finish_time)
63
63
  @report.head.merge! @config.global
64
64
  @report.head.merge! @config.local
@@ -68,5 +68,4 @@ class Case
68
68
  @report.tail[:finish_time] = finish_time
69
69
  @report.tail[:duration] = finish_time - start_time
70
70
  end
71
- # rubocop:enable Metrics/AbcSize
72
71
  end
@@ -39,12 +39,12 @@ class CaseManager
39
39
  # Run all cases
40
40
  def run_all_cases
41
41
  start_time = Time.now
42
- if Application.instance.global[:tt_sequence]
43
- verboseln Rainbow("[INFO] Running in sequence (#{start_time})").yellow.bright
42
+ if Application.instance.global[:tt_sequence] == true
43
+ verboseln Rainbow("==> Teuton: Running in sequence (#{start_time})").yellow.bright
44
44
  # Run every case in sequence
45
45
  @cases.each(&:play)
46
46
  else
47
- verboseln Rainbow("[INFO] Running in parallel (#{start_time})").yellow.bright
47
+ verboseln Rainbow("==> Teuton: Running in parallel (#{start_time})").yellow.bright
48
48
  threads = []
49
49
  # Run all cases in parallel
50
50
  @cases.each { |c| threads << Thread.new { c.play } }
@@ -78,7 +78,6 @@ class CaseManager
78
78
  @cases.each { |c| threads << Thread.new { c.close uniques } }
79
79
  threads.each(&:join)
80
80
 
81
- # Build Hall of Fame
82
81
  build_hall_of_fame
83
82
  end
84
83
  end
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative 'check_cases'
4
3
  require_relative 'hall_of_fame'
@@ -12,17 +12,13 @@ class CaseManager
12
12
  def open_main_report(config_filepath)
13
13
  app = Application.instance
14
14
 
15
- @report.head[:tt_title] = "Executing [#{app.name}] (version #{Application::VERSION})"
15
+ @report.head[:tt_title] = "Teuton (#{Teuton::VERSION})"
16
16
  @report.head[:tt_scriptname] = trim(app.script_path)
17
17
  @report.head[:tt_configfile] = trim(config_filepath)
18
18
  @report.head[:tt_pwd] = app.running_basedir
19
19
  @report.head[:tt_debug] = true if @debug
20
20
  # @report.head[:tt_uses] = app.uses.join(', ') # TO-REVISE
21
21
  @report.head.merge!(app.global)
22
-
23
- verboseln ' '
24
- verboseln '=' * @report.head[:tt_title].length
25
- verboseln Rainbow(@report.head[:tt_title]).yellow.bright
26
22
  end
27
23
 
28
24
  def close_main_report(start_time)
@@ -31,9 +27,8 @@ class CaseManager
31
27
  @report.tail[:finish_time] = finish_time
32
28
  @report.tail[:duration] = finish_time - start_time
33
29
 
34
- verbose Rainbow("\n[INFO] Duration = #{format('%3.3f',(finish_time - start_time))}").yellow.bright
35
- verboseln Rainbow(" (#{finish_time})").yellow.bright
36
- verboseln '=' * @report.head[:tt_title].length
30
+ verbose Rainbow("\n==> Teuton: Duration=#{format('%3.3f',(finish_time - start_time))}").yellow.bright
31
+ verboseln Rainbow(" (#{finish_time})").yellow.bright
37
32
  verboseln ' '
38
33
 
39
34
  app = Application.instance
@@ -1,8 +1,7 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative '../application'
3
+ require 'fileutils'
4
4
 
5
- # Define general use methods
6
5
  module Utils
7
6
  # Create the directory if it dosn't exist.
8
7
  def ensure_dir(dirname)
@@ -13,7 +12,6 @@ module Utils
13
12
  true
14
13
  end
15
14
 
16
- # rubocop:disable Metrics/MethodLength
17
15
  def encode_and_split(encoding, text)
18
16
  # Convert text to UTF-8 deleting unknown chars
19
17
  text ||= '' # Ensure text is not nil
@@ -31,7 +29,6 @@ module Utils
31
29
 
32
30
  text.split("\n")
33
31
  end
34
- # rubocop:enable Metrics/MethodLength
35
32
 
36
33
  def my_execute(cmd, encoding = 'UTF-8')
37
34
  return { exitstatus: 0, content: '' } if Application.instance.debug
@@ -1,5 +1,5 @@
1
1
  ---
2
- :global:
3
- :cases:
4
- - :tt_members: MEMBERS
5
- :tt_moodle_id: MOODLE_ID
2
+ global:
3
+ cases:
4
+ - tt_members: MEMBERS
5
+ tt_moodle_id: MOODLE_ID
@@ -1,9 +1,9 @@
1
1
 
2
2
  group "GROUP NAME" do
3
3
 
4
- target "TARGET-1 DESCRIPTION"
5
- run "COMMAND-1"
6
- expect "TEXT-1"
4
+ target "TARGET.1 DESCRIPTION"
5
+ run "COMMAND.1"
6
+ expect "TEXT.1"
7
7
 
8
8
  end
9
9
 
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative '../application'
4
3
  require_relative '../utils/configfile_reader'
@@ -44,8 +43,6 @@ class Readme
44
43
  reset
45
44
  end
46
45
 
47
- ##
48
- # Show README on screen
49
46
  def show
50
47
  process_content
51
48
  show_head
@@ -55,8 +52,6 @@ class Readme
55
52
 
56
53
  private
57
54
 
58
- ##
59
- # Reset attributes
60
55
  def reset
61
56
  app = Application.instance
62
57
  @config = ConfigFileReader.read(app.config_path)
@@ -86,8 +81,6 @@ class Readme
86
81
  @action = { readme: [] }
87
82
  end
88
83
 
89
- ##
90
- # Show README head
91
84
  def show_head
92
85
  app = Application.instance
93
86
  puts '```'
@@ -117,12 +110,10 @@ class Readme
117
110
  @cases_params.sort!
118
111
  puts Lang::get(:params)
119
112
  @cases_params.uniq.each { |i| puts format('* %s', i) }
120
- puts "\n> NOTE: Save every ':param: value' into config file."
113
+ puts "\n> NOTE: Save every 'param: value' into config file."
121
114
  end
122
115
  end
123
116
 
124
- ##
125
- # Show README content
126
117
  def show_content
127
118
  @data[:groups].each do |group|
128
119
  next if group[:actions].empty?
@@ -148,8 +139,6 @@ class Readme
148
139
  end
149
140
  end
150
141
 
151
- ##
152
- # Show README tail
153
142
  def show_tail
154
143
  return if @global_params.empty?
155
144
 
@@ -170,3 +159,4 @@ class Readme
170
159
  @setted_params.each_pair { |k,v| puts "|#{k}|#{v}|" }
171
160
  end
172
161
  end
162
+
@@ -1,13 +1,10 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require 'fileutils'
4
3
  require 'rainbow'
5
4
 
6
- # Skeleton module
7
5
  module Skeleton
8
6
  ##
9
7
  # Create teuton project skeleton
10
- # @param project_dir (String)
11
8
  def self.create(project_dir)
12
9
  project_name = File.basename(project_dir)
13
10
  puts "\n[INFO] Creating #{Rainbow(project_name).bright} project skeleton"
@@ -33,9 +30,6 @@ module Skeleton
33
30
  end
34
31
  end
35
32
 
36
- ##
37
- # Create dir
38
- # @param dirpath (String)
39
33
  private_class_method def self.create_dir(dirpath)
40
34
  if Dir.exist? dirpath
41
35
  puts "* Exists dir! => #{Rainbow(dirpath).yellow}"
@@ -67,5 +61,4 @@ module Skeleton
67
61
  end
68
62
  end
69
63
  end
70
- # rubocop:enable Metrics/MethodLength
71
64
  end
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require 'yaml'
4
3
  require 'json/pure'
@@ -29,9 +28,6 @@ module ConfigFileReader
29
28
  # Read YAML config file
30
29
  # @param filepath (String) Path to YAML config file
31
30
  # @return Hash with config data
32
- # rubocop:disable Metrics/MethodLength
33
- # rubocop:disable Metrics/AbcSize
34
- # rubocop:disable Security/YAMLLoad
35
31
  def self.read_yaml(filepath)
36
32
  begin
37
33
  data = YAML.load(File.open(filepath))
@@ -49,9 +45,6 @@ module ConfigFileReader
49
45
  read_included_files!(filepath, data)
50
46
  data
51
47
  end
52
- # rubocop:enable Metrics/MethodLength
53
- # rubocop:enable Metrics/AbcSize
54
- # rubocop:enable Security/YAMLLoad
55
48
 
56
49
  ##
57
50
  # Read JSON config file
@@ -71,7 +64,6 @@ module ConfigFileReader
71
64
  # Read all configuration files from "filepath" folder.
72
65
  # @param filepath (String) Folder with config files
73
66
  # @param data (Hash) Input configuration
74
- # rubocop:disable Security/YAMLLoad
75
67
  private_class_method def self.read_included_files!(filepath, data)
76
68
  return if data[:global][:tt_include].nil?
77
69
 
@@ -94,10 +86,7 @@ module ConfigFileReader
94
86
  end
95
87
  }
96
88
  end
97
- # rubocop:enable Security/YAMLLoad
98
89
 
99
- # rubocop:disable Metrics/MethodLength
100
- # rubocop:disable Metrics/AbcSize
101
90
  private_class_method def self.convert_string_keys_to_symbol(input)
102
91
  return input if input.class != Hash
103
92
 
@@ -116,6 +105,4 @@ module ConfigFileReader
116
105
  end
117
106
  output
118
107
  end
119
- # rubocop:enable Metrics/MethodLength
120
- # rubocop:enable Metrics/AbcSize
121
108
  end
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require 'rainbow'
4
3
  require_relative '../application'
@@ -29,8 +28,6 @@ module NameFileFinder
29
28
  ##
30
29
  # Find project filenames from input folder path
31
30
  # @param folder_path (String)
32
- # rubocop:disable Metrics/AbcSize
33
- # rubocop:disable Metrics/MethodLength
34
31
  def self.find_filenames_from_directory(folder_path)
35
32
  # COMPLEX MODE: We use start.rb as main RB file
36
33
  script_path = File.join(folder_path, 'start.rb')
@@ -48,15 +45,10 @@ module NameFileFinder
48
45
 
49
46
  find_configfilename_from_directory(folder_path)
50
47
  end
51
- # rubocop:enable Metrics/AbcSize
52
- # rubocop:enable Metrics/MethodLength
53
48
 
54
49
  ##
55
50
  # Find project config filename from input folder path
56
51
  # @param folder_path (String)
57
- # rubocop:disable Metrics/AbcSize
58
- # rubocop:disable Metrics/MethodLength
59
- # rubocop:disable Style/IfUnlessModifier
60
52
  def self.find_configfilename_from_directory(folder_path)
61
53
  # COMPLEX MODE: We use config.yaml by default
62
54
  app = Application.instance
@@ -76,12 +68,7 @@ module NameFileFinder
76
68
  end
77
69
  app.config_path = config_path
78
70
  end
79
- # rubocop:enable Metrics/AbcSize
80
- # rubocop:enable Metrics/MethodLength
81
- # rubocop:enable Style/IfUnlessModifier
82
71
 
83
- # rubocop:disable Metrics/AbcSize
84
- # rubocop:disable Metrics/MethodLength
85
72
  def self.find_filenames_from_rb(script_path)
86
73
  # SIMPLE MODE: We use script_path as main RB file
87
74
  # This must be fullpath to DSL script file
@@ -99,12 +86,7 @@ module NameFileFinder
99
86
 
100
87
  find_configfilenames_from_rb(script_path)
101
88
  end
102
- # rubocop:enable Metrics/AbcSize
103
- # rubocop:enable Metrics/MethodLength
104
89
 
105
- # rubocop:disable Metrics/MethodLength
106
- # rubocop:disable Metrics/AbcSize
107
- # rubocop:disable Style/IfUnlessModifier
108
90
  def self.find_configfilenames_from_rb(script_path)
109
91
  # SIMPLE MODE: We use script_path as main RB file
110
92
  # This must be fullpath to DSL script file
@@ -126,33 +108,6 @@ module NameFileFinder
126
108
  end
127
109
  app.config_path = config_path
128
110
  end
129
- # rubocop:enable Metrics/MethodLength
130
- # rubocop:enable Metrics/AbcSize
131
- # rubocop:enable Style/IfUnlessModifier
132
-
133
- # def self.puts_input_info_on_screen
134
- # app = Application.instance
135
- #
136
- # verbose Rainbow('[INFO] ScriptPath => ').blue
137
- # verboseln Rainbow(trim(app.script_path)).blue.bright
138
- # verbose Rainbow('[INFO] ConfigPath => ').blue
139
- # verboseln Rainbow(trim(app.config_path)).blue.bright
140
- # verbose Rainbow('[INFO] Pwd => ').blue
141
- # verboseln Rainbow(app.running_basedir).blue.bright
142
- # verbose Rainbow('[INFO] TestName => ').blue
143
- # verboseln Rainbow(trim(app.test_name)).blue.bright
144
- # end
145
-
146
- ##
147
- # Trim string text when is too long
148
- # def self.trim(input)
149
- # return input unless input.to_s.start_with? Dir.pwd.to_s
150
- #
151
- # output = input.to_s
152
- # offset = (Dir.pwd).length + 1
153
- # output = "#{input[offset, input.size]}"
154
- # output.to_s
155
- # end
156
111
 
157
112
  def self.verboseln(text)
158
113
  verbose(text + "\n")
@@ -1,7 +1,6 @@
1
1
 
2
2
  require_relative '../application'
3
3
 
4
- # Define general use methods
5
4
  module Verbose
6
5
  def verboseln(text)
7
6
  verbose(text + "\n")
@@ -9,7 +8,7 @@ module Verbose
9
8
 
10
9
  def verbose(text)
11
10
  return if Application.instance.quiet?
12
-
11
+
13
12
  print text
14
13
  end
15
14
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Teuton
3
- VERSION = '2.3.2'
3
+ VERSION = '2.3.5'
4
4
  APPNAME = 'teuton'
5
5
  GEMNAME = 'teuton'
6
6
  DOCKERNAME = "dvarrui/#{GEMNAME}"
data/lib/teuton.rb CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
2
  require_relative 'teuton/application'
3
- require_relative 'teuton/skeleton'
4
3
 
5
4
  module Teuton
6
5
  def self.create(path_to_new_dir)
6
+ require_relative 'teuton/skeleton'
7
7
  Skeleton.create(path_to_new_dir)
8
8
  end
9
9
 
@@ -13,7 +13,7 @@ module Teuton
13
13
  end
14
14
 
15
15
  def self.readme(projectpath, options = {})
16
- # Create Readme file for a test
16
+ # Create Readme file for a teuton test
17
17
  Application.instance.add_input_params(projectpath, options)
18
18
  require_dsl_and_script('teuton/readme/readme') # Define DSL keywords
19
19
 
@@ -39,7 +39,7 @@ module Teuton
39
39
  require_relative app.script_path
40
40
  rescue SyntaxError => e
41
41
  puts e.to_s
42
- puts Rainbow.new("[ FAIL ] SyntaxError into file #{app.script_path}").red
42
+ puts Rainbow.new("==> [FAIL] SyntaxError into file #{app.script_path}").red
43
43
  end
44
44
  end
45
45
  end
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.2
4
+ version: 2.3.5
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-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -378,5 +378,5 @@ requirements: []
378
378
  rubygems_version: 3.1.6
379
379
  signing_key:
380
380
  specification_version: 4
381
- summary: Teuton (Teuton Software)
381
+ summary: Teuton (Infrastructure test)
382
382
  test_files: []