teuton 2.1.0 → 2.1.1
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 +4 -4
- data/bin/teuton +2 -2
- data/lib/teuton/application.rb +2 -2
- data/lib/teuton/command/main.rb +0 -2
- data/lib/teuton/command/play.rb +4 -1
- data/lib/teuton/command/readme.rb +1 -1
- data/lib/teuton/command/test.rb +1 -1
- data/lib/teuton/command/update.rb +1 -1
- data/lib/teuton/command/version.rb +1 -1
- data/lib/teuton/command.rb +34 -0
- data/lib/teuton/project/configfile_reader.rb +1 -1
- data/lib/teuton/project/project_creator.rb +7 -6
- data/lib/teuton/report/formatter/json_formatter.rb +1 -0
- data/lib/teuton/report/formatter/resume_json_formatter.rb +1 -0
- data/lib/teuton.rb +39 -9
- metadata +13 -15
- data/lib/teuton/command/create.rb +0 -20
- data/lib/teuton/command/download.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 118f06096e18d4e4e8a820460912f2585fa6cb2a22297defd54f45a59306cc37
|
4
|
+
data.tar.gz: 871b5189621de21ecf4c3de56434a7ded8c20fe486459c7bc3f7605b5c3c07ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 523106ae12c17ff1fc1de7d43b276c51c17c3c92cf7e0498f12fcd665650dc4e98bc0decf8569985a81baa1cc83dc3dccb26f9a81102f072034fb0fa26199219
|
7
|
+
data.tar.gz: 456521fc910d9f2fa4787c05239a40701c3366584c897723e213032351c4bfed79a3216d97e60758c3cbafcf05099d60b1a425b61483ca75bf86f1dc61a0826c
|
data/bin/teuton
CHANGED
data/lib/teuton/application.rb
CHANGED
data/lib/teuton/command/main.rb
CHANGED
data/lib/teuton/command/play.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Teuton#play
|
4
|
-
class
|
4
|
+
class TeutonCommand < Thor
|
5
5
|
map ['p', '-p', 'play', '--play'] => 'play'
|
6
6
|
option :export, type: :string
|
7
7
|
option :cname, type: :string
|
@@ -28,6 +28,9 @@ class Teuton < Thor
|
|
28
28
|
(5) teuton foo/demo.rb, Run challenge from foo/demo.rb with foo/demo.yaml config file.
|
29
29
|
|
30
30
|
LONGDESC
|
31
|
+
##
|
32
|
+
# Execute Teuton test unit
|
33
|
+
# @param path_to_rb_file [String] Route to main rb Teuton file
|
31
34
|
def play(path_to_rb_file)
|
32
35
|
Project.play(path_to_rb_file, options)
|
33
36
|
end
|
data/lib/teuton/command/test.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require_relative 'application'
|
3
|
+
require_relative 'project/project'
|
4
|
+
require_relative 'project/project_creator.rb'
|
5
|
+
require_relative 'command/main'
|
6
|
+
|
7
|
+
##
|
8
|
+
# Command Line User Interface
|
9
|
+
class TeutonCommand < Thor
|
10
|
+
map ['h', '-h', '--help'] => 'help'
|
11
|
+
|
12
|
+
def method_missing(method, *_args, &_block)
|
13
|
+
play(method.to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
def respond_to_missing?(method_name, include_private = false)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
map ['c', '-c', '--create'] => 'create'
|
21
|
+
desc 'create DIRECTORY', 'Create skeleton for a new project'
|
22
|
+
long_desc <<-LONGDESC
|
23
|
+
Create files for a new project: foo.rb, foo.yaml and .gitignore
|
24
|
+
|
25
|
+
Example:
|
26
|
+
|
27
|
+
#{$PROGRAM_NAME} create foo/demo
|
28
|
+
LONGDESC
|
29
|
+
##
|
30
|
+
# Command create new Teuton project
|
31
|
+
def create(path_to_new_dir)
|
32
|
+
ProjectCreator.create(path_to_new_dir)
|
33
|
+
end
|
34
|
+
end
|
@@ -25,10 +25,10 @@ module ProjectCreator
|
|
25
25
|
def self.create_main_dir_and_files(project_dir, source_basedir)
|
26
26
|
# Directory and files: Ruby script, Configfile, gitignore
|
27
27
|
items = [
|
28
|
-
{ source: '
|
29
|
-
{ source: '
|
30
|
-
{ source: '
|
31
|
-
{ source: '
|
28
|
+
{ source: 'teuton/files/config.yaml', target: 'config.yaml' },
|
29
|
+
{ source: 'teuton/files/start.rb', target: 'start.rb' },
|
30
|
+
{ source: 'teuton/files/README.md', target: 'README.md' },
|
31
|
+
{ source: 'teuton/files/gitignore', target: '.gitignore' }
|
32
32
|
]
|
33
33
|
items.each do |item|
|
34
34
|
source = File.join(source_basedir, item[:source])
|
@@ -54,7 +54,7 @@ module ProjectCreator
|
|
54
54
|
begin
|
55
55
|
FileUtils.mkdir_p(dirpath)
|
56
56
|
puts "* Create dir => #{Rainbow(dirpath).green}"
|
57
|
-
rescue
|
57
|
+
rescue StandardError
|
58
58
|
puts "* Create dir ERROR => #{Rainbow(dirpath).red}"
|
59
59
|
end
|
60
60
|
end
|
@@ -68,10 +68,11 @@ module ProjectCreator
|
|
68
68
|
if File.exist? dest
|
69
69
|
puts "* Exists file! => #{Rainbow(dest).yellow}"
|
70
70
|
else
|
71
|
+
puts "* File not found! => #{Rainbow(target).yellow}" unless File.exist? target
|
71
72
|
begin
|
72
73
|
FileUtils.cp(target, dest)
|
73
74
|
puts "* Create file => #{Rainbow(dest).green}"
|
74
|
-
rescue
|
75
|
+
rescue StandardError
|
75
76
|
puts "* Create file ERROR => #{Rainbow(dest).red}"
|
76
77
|
end
|
77
78
|
end
|
data/lib/teuton.rb
CHANGED
@@ -1,17 +1,47 @@
|
|
1
|
-
require 'thor'
|
2
1
|
require_relative 'teuton/application'
|
3
2
|
require_relative 'teuton/project/project'
|
4
|
-
require_relative 'teuton/
|
3
|
+
require_relative 'teuton/project/project_creator'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
##
|
6
|
+
# Main Teuton functions
|
7
|
+
module Teuton
|
8
|
+
##
|
9
|
+
# Create new Teuton project
|
10
|
+
def self.create(path_to_new_dir)
|
11
|
+
ProjectCreator.create(path_to_new_dir)
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Play (run) Teuton project.
|
16
|
+
# @param path_to_rb_file [String] Path to main rb file.
|
17
|
+
# @param options [Hash] Options like
|
18
|
+
# * :export [String]
|
19
|
+
# * :cname [String]
|
20
|
+
# * :cpath [String]
|
21
|
+
# * :case [String]
|
22
|
+
# * :quiet [Boolean]
|
23
|
+
def self.play(path_to_rb_file, options = {})
|
24
|
+
Project.play(path_to_rb_file, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Generate readme for Teuton project.
|
29
|
+
# @param path_to_rb_file [String] Path to main rb file.
|
30
|
+
def self.readme(path_to_rb_file)
|
31
|
+
Project.readme(path_to_rb_file, options)
|
32
|
+
end
|
9
33
|
|
10
|
-
|
11
|
-
|
34
|
+
##
|
35
|
+
# Simulate play Teuton project, check syntax and display stats.
|
36
|
+
# @param path_to_rb_file [String] Path to main rb file.
|
37
|
+
def self.test(path_to_rb_file)
|
38
|
+
Project.test(path_to_rb_file, options)
|
12
39
|
end
|
13
40
|
|
14
|
-
|
15
|
-
|
41
|
+
##
|
42
|
+
# Display Teuton version
|
43
|
+
def self.version
|
44
|
+
print Rainbow(Application::NAME).bright.blue
|
45
|
+
puts ' (version ' + Rainbow(Application::VERSION).green + ')'
|
16
46
|
end
|
17
47
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teuton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
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: 2019-11-
|
11
|
+
date: 2019-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json_pure
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-sftp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,15 +137,14 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.74'
|
139
139
|
description: |2
|
140
|
-
Intrastructure
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
[ALL] ruby, make, gcc
|
145
|
-
[Debian] ssh, ruby-dev
|
146
|
-
[OpenSUSE] openssh, ruby-devel
|
140
|
+
Intrastructure test, useful for:
|
141
|
+
(1) Sysadmin teachers to evaluate students remote machines.
|
142
|
+
(2) Sysadmin apprentices to evaluate their learning process as a game.
|
143
|
+
(3) Professional sysadmin to monitor remote machines.
|
147
144
|
|
148
|
-
|
145
|
+
Allow us:
|
146
|
+
(a) Write test units for real or virtual machines using simple DSL.
|
147
|
+
(b) Check compliance with requirements on remote machines.
|
149
148
|
email: teuton.software@protonmail.com
|
150
149
|
executables:
|
151
150
|
- teuton
|
@@ -193,8 +192,7 @@ files:
|
|
193
192
|
- lib/teuton/case_manager/report.rb
|
194
193
|
- lib/teuton/case_manager/show.rb
|
195
194
|
- lib/teuton/case_manager/utils.rb
|
196
|
-
- lib/teuton/command
|
197
|
-
- lib/teuton/command/download.rb
|
195
|
+
- lib/teuton/command.rb
|
198
196
|
- lib/teuton/command/main.rb
|
199
197
|
- lib/teuton/command/play.rb
|
200
198
|
- lib/teuton/command/readme.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../project/project_creator.rb'
|
4
|
-
|
5
|
-
# Teuton#create
|
6
|
-
class Teuton < Thor
|
7
|
-
map ['c', '-c', '--create'] => 'create'
|
8
|
-
desc 'create DIRECTORY', 'Create skeleton for a new project'
|
9
|
-
long_desc <<-LONGDESC
|
10
|
-
Create files for a new project: foo.rb, foo.yaml and .gitignore
|
11
|
-
|
12
|
-
Example:
|
13
|
-
|
14
|
-
#{$PROGRAM_NAME} create foo/demo
|
15
|
-
|
16
|
-
LONGDESC
|
17
|
-
def create(path_to_new_dir)
|
18
|
-
ProjectCreator.create(path_to_new_dir)
|
19
|
-
end
|
20
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rainbow'
|
4
|
-
|
5
|
-
# Class method Teuton#download
|
6
|
-
class Teuton < Thor
|
7
|
-
map ['-dc', '--dc', '--download'] => 'download'
|
8
|
-
desc 'download', 'Download Teuton challenges from git repo'
|
9
|
-
long_desc <<-LONGDESC
|
10
|
-
- Download Teuton challenges from git repo.
|
11
|
-
|
12
|
-
- Same as:
|
13
|
-
git clone https://github.com/teuton-software/teuton-challenges.git
|
14
|
-
|
15
|
-
Example:
|
16
|
-
|
17
|
-
#{$PROGRAM_NAME} download
|
18
|
-
|
19
|
-
LONGDESC
|
20
|
-
def download
|
21
|
-
repo = 'teuton-challenges'
|
22
|
-
puts "[INFO] Downloading <#{repo}> repo..."
|
23
|
-
ok = system("git clone https://github.com/teuton-software/#{repo}.git")
|
24
|
-
if ok
|
25
|
-
puts "[INFO] Your files are into <#{Rainbow(repo).bright}> directory..."
|
26
|
-
else
|
27
|
-
puts Rainbow('[ERROR] Ensure: ').red
|
28
|
-
puts Rainbow(' 1. Git is installed.').red
|
29
|
-
puts Rainbow(' 2. Your Internet connection is working.').red
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|