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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8888bb5a43b357d2968cdcf354d1bad4851649f282a4ef1d24f7ad26ba04243
4
- data.tar.gz: 2c476f06e9b429c19c4fc87c0fd783b30fd4931bf2887fcf7fe834c86463e028
3
+ metadata.gz: 118f06096e18d4e4e8a820460912f2585fa6cb2a22297defd54f45a59306cc37
4
+ data.tar.gz: 871b5189621de21ecf4c3de56434a7ded8c20fe486459c7bc3f7605b5c3c07ee
5
5
  SHA512:
6
- metadata.gz: b0ca5960c2334209ae1bf9058cb017554664b58b1d7b7854b647efb9bf240e09098d4a939f0325b3056910029251412b76aea57a06d72db20a3e1febe091266f
7
- data.tar.gz: e6a0f6a97d6a77a4c7e7ad9286de04de2145c15d40be0b781f9d7f98db5d28cdc662ff570cb7e4573c264f03cac6bd56946935d32852eafbee9bb9647b343ac3
6
+ metadata.gz: 523106ae12c17ff1fc1de7d43b276c51c17c3c92cf7e0498f12fcd665650dc4e98bc0decf8569985a81baa1cc83dc3dccb26f9a81102f072034fb0fa26199219
7
+ data.tar.gz: 456521fc910d9f2fa4787c05239a40701c3366584c897723e213032351c4bfed79a3216d97e60758c3cbafcf05099d60b1a425b61483ca75bf86f1dc61a0826c
data/bin/teuton CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'teuton'
4
- Teuton.start(ARGV)
3
+ require 'teuton/command'
4
+ TeutonCommand.start(ARGV)
@@ -4,8 +4,8 @@ require 'singleton'
4
4
  class Application
5
5
  include Singleton
6
6
 
7
- VERSION = '2.1.0'
8
- NAME = 'teuton'
7
+ VERSION = '2.1.1' # Application version
8
+ NAME = 'teuton' # Application name
9
9
 
10
10
  attr_reader :letter
11
11
  attr_reader :running_basedir, :output_basedir
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'create'
4
- require_relative 'download'
5
3
  require_relative 'play'
6
4
  require_relative 'readme'
7
5
  require_relative 'test'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Teuton#play
4
- class Teuton < Thor
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Teuton#readme
4
- class Teuton < Thor
4
+ class TeutonCommand < Thor
5
5
  map ['r', '-r', '--readme'] => 'readme'
6
6
  option :lang, type: :string
7
7
  desc 'readme DIRECTORY',
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Teuton#test
4
- class Teuton < Thor
4
+ class TeutonCommand < Thor
5
5
  map ['t', '-t', '--test'] => 'test'
6
6
  option :c, type: :boolean
7
7
  option :cname, type: :string
@@ -3,7 +3,7 @@
3
3
  require 'rainbow'
4
4
 
5
5
  # Class method Teuton#update
6
- class Teuton < Thor
6
+ class TeutonCommand < Thor
7
7
  map ['--update', '-u', 'u'] => 'update'
8
8
  desc 'update', 'Update TEUTON from git repo'
9
9
  long_desc <<-LONGDESC
@@ -3,7 +3,7 @@
3
3
  require 'rainbow'
4
4
 
5
5
  # Class method Teuton#version
6
- class Teuton < Thor
6
+ class TeutonCommand < Thor
7
7
  map ['v', '-v', '--version'] => 'version'
8
8
  desc 'version', 'Show the program version'
9
9
  def version
@@ -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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
- require 'json'
4
+ require 'json/pure'
5
5
 
6
6
  # Functions that read data from ConfigFile using formats YAML and JSON
7
7
  # * read
@@ -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: 'lib/files/config.yaml', target: 'config.yaml' },
29
- { source: 'lib/files/start.rb', target: 'start.rb' },
30
- { source: 'lib/files/README.md', target: 'README.md' },
31
- { source: 'lib/files/gitignore', target: '.gitignore' }
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 StandarError
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 StandarError
75
+ rescue StandardError
75
76
  puts "* Create file ERROR => #{Rainbow(dest).red}"
76
77
  end
77
78
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json/pure'
3
4
  require_relative 'array_formatter'
4
5
 
5
6
  # JSONFormatter class
@@ -1,4 +1,5 @@
1
1
 
2
+ require 'json/pure'
2
3
  require_relative 'resume_array_formatter'
3
4
 
4
5
  # JSONFormatter class
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/command/main'
3
+ require_relative 'teuton/project/project_creator'
5
4
 
6
- # Command Line User Interface
7
- class Teuton < Thor
8
- map ['h', '-h', '--help'] => 'help'
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
- def method_missing(method, *_args, &_block)
11
- play(method.to_s)
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
- def respond_to_missing?(method_name, include_private = false)
15
- super
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2019-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
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.1'
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.1'
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 Test Software.
141
-
142
- Some dependencies require compilation.
143
- Ensure these packages are installed into your local hosts:
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
- Read Teuton documentation: https://github.com/teuton-software/teuton/wiki/
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/create.rb
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