teuton 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -9
  3. data/bin/teuton +2 -2
  4. data/docs/commands/{commands.md → README.md} +0 -0
  5. data/docs/dsl/{keywords.md → README.md} +0 -0
  6. data/docs/install/README.md +53 -0
  7. data/docs/install/manual.md +38 -0
  8. data/docs/install/{scripts_install.md → scripts.md} +6 -6
  9. data/docs/install/tested_os.md +25 -0
  10. data/docs/install/vagrant.md +8 -0
  11. data/docs/learn/{learning.md → README.md} +0 -0
  12. data/docs/learn/example-01-target.md +1 -1
  13. data/docs/learn/example-02-configfile.md +1 -1
  14. data/docs/learn/example-03-remote-hosts.md +1 -1
  15. data/docs/learn/example-04-use.md +1 -1
  16. data/docs/learn/example-05-debug.md +1 -1
  17. data/lib/teuton/application.rb +1 -1
  18. data/lib/teuton/case_manager/case/config.rb +9 -7
  19. data/lib/teuton/case_manager/case/dsl/goto.rb +6 -11
  20. data/lib/teuton/case_manager/case/dsl/log.rb +10 -2
  21. data/lib/teuton/case_manager/case/runner.rb +33 -6
  22. data/lib/teuton/case_manager/show.rb +1 -0
  23. data/lib/teuton/case_manager/utils.rb +3 -1
  24. data/lib/teuton/{command → cli}/main.rb +0 -1
  25. data/lib/teuton/{command → cli}/play.rb +4 -4
  26. data/lib/teuton/{command → cli}/readme.rb +3 -3
  27. data/lib/teuton/{command → cli}/test.rb +5 -5
  28. data/lib/teuton/{command → cli}/version.rb +3 -1
  29. data/lib/teuton/{command.rb → cli.rb} +20 -16
  30. data/lib/teuton/project/laboratory/laboratory.rb +11 -1
  31. data/lib/teuton/project/project.rb +4 -4
  32. data/lib/teuton/project/readme/dsl.rb +5 -4
  33. data/lib/teuton/project/readme/lang.rb +2 -2
  34. data/lib/teuton/project/readme/readme.rb +1 -0
  35. data/lib/teuton/project/{project_creator.rb → skeleton.rb} +3 -16
  36. data/lib/teuton.rb +2 -2
  37. metadata +26 -29
  38. data/docs/install/install.md +0 -32
  39. data/docs/install/manual_install.md +0 -25
  40. data/docs/install/tested_od.md +0 -25
  41. data/docs/install/vagrant_install.md +0 -15
  42. data/lib/teuton/command/update.rb +0 -27
  43. data/lib/teuton/rake_function/check.rb +0 -39
  44. data/lib/teuton/rake_function/install.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a118fef48cafbf7a11e722dc32aefc5011e1a5729235f3121cae55f3bbfa4161
4
- data.tar.gz: 8d1ce9d0f933059ec246a807f74300e517af4b50b71c5383e875832a62348437
3
+ metadata.gz: f56e4167c40780e0550622b1bf0a32a844dfb2095ce4decfefae6ef4ec3ee81c
4
+ data.tar.gz: 2837ebcb35eeb895e68f714ac14d91e2224df08590fa9820862f448913bcef85
5
5
  SHA512:
6
- metadata.gz: 25ba06c39a87c6d7f03472490fc9d46be563b52ba42a1be7ecda267a8919e3ce7d056603b548958ba61e385df6eb4a5af3741540807fdc1574fdca3da7736f1f
7
- data.tar.gz: 1ce63b708fea7a9e02bba3d753943aa89ff3ca8fb41f598bd4553d58ebdcded2483bea5471aa96278edee452772abb37044c2e86dfe9c355e5586d4317c3cc24
6
+ metadata.gz: a03c6981eb476d5337c3bcda5db95cfc35efb6f17ede323cc26ebc6027cf3095a66beb8715a20669b85dbb86b6f67a9217538f8438e47f2bff9eb3f924e5780d
7
+ data.tar.gz: 1e5118978596288b91f4c71ca4aef2ce7f9c4aa5e3b14f07bfc9f887b75a75456447b75b4da6ddc07e25d66f78867f90d9924568832463c2bcb321d8682cae54
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
- # TEUTON Software (version 2.1)
2
+ [![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
3
+
4
+ # TEUTON (version 2.1)
3
5
 
4
6
  _Create Unit Test for your machines, and
5
7
  test your infraestructure as code._
@@ -15,22 +17,25 @@ Teuton allow us:
15
17
  * Write test units for real or virtual machines using simple DSL.
16
18
  * Check compliance with requirements on remote machines.
17
19
 
20
+ ---
18
21
  # Documentation
19
22
 
20
- Teuton [documentation](./docs).
21
-
22
- * [Installation](docs/install/install.md)
23
- * [Learning](docs/learn/README.md)
24
- * [Commands](docs/commands/commands.md)
25
- * [DSL keywords](docs/dsl/keywords.md)
23
+ * [Installation](https://github.com/teuton-software/teuton/tree/devel/docs/install/README.md)
24
+ 1. Install Ruby on your system.
25
+ 2. `gem install teuton`
26
+ * [Learning](https://github.com/teuton-software/teuton/tree/devel/docs/learn/README.md)
27
+ * [Commands](https://github.com/teuton-software/teuton/tree/devel/docs/commands/README.md)
28
+ * [DSL keywords](https://github.com/teuton-software/teuton/tree/devel/docs/dsl/README.md)
26
29
 
30
+ ---
27
31
  # Features
28
32
 
29
- * [Free Software License](LICENSE).
30
- * Multiplatform [installation](https://github.com/teuton-software/teuton/wiki/Installation).
33
+ * [Free Software License](https://github.com/teuton-software/teuton/tree/devel/LICENSE).
34
+ * Multiplatform .
31
35
  * Use SSH or Telnet protocol to connect to remote machines.
32
36
  * Developed using the ruby language.
33
37
 
38
+ ---
34
39
  # Contact
35
40
 
36
41
  * **Email**: `teuton.software@protonmail.com`
data/bin/teuton CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'teuton/command'
4
- TeutonCommand.start(ARGV)
3
+ require_relative 'teuton/cli'
4
+ CLI.start(ARGV)
File without changes
File without changes
@@ -0,0 +1,53 @@
1
+
2
+ There are different Teuton [Modes of use](modes_of_use.md). For every mode there are 2 node types and every node has their own installation script:
3
+
4
+ * **T-node**: This host has installed Teuton software.
5
+ * **S-node**: This host has installed SSH server.
6
+
7
+ ---
8
+ # T-NODE
9
+
10
+ * **Install** Teuton on machine with T-NODE role.
11
+ Installation process:
12
+ 1. Install Ruby on your system.
13
+ 2. `gem install teuton`
14
+ * Run `teuton version` to check that your installation is ok.
15
+
16
+ > **PROBLEMS**: If you have problems to find `teuton`command (OpenSUSE distro), try this:
17
+ > * Option A:
18
+ > * `ruby -v`, display your current ruby version. Supose it is 2.5.
19
+ > * Run `teuton.ruby2.5`, instead of `teuton`.
20
+ > * Option B:
21
+ > * `find /usr/lib64/ruby -name teuton`, to find absolute path to teuton command.
22
+ > * `sudo ln -s /PATH/TO/bin/teuton /usr/local/bin/teuton`, to create symbolic link to teuton command.
23
+
24
+ * **Update** Teuton with `gem teuton update`.
25
+ * **Uninstall** Teuton with `gem uninstall teuton`
26
+
27
+ ---
28
+ # S-NODE
29
+
30
+ * **Install** SSH server on every machine with S-NODE role.
31
+
32
+ ---
33
+ # Other installation ways
34
+
35
+ ## Using scripts
36
+
37
+ [Installation using scripts](scripts.md)
38
+ * Use our scripts to run automatical installation for your OS.
39
+ * Use this way if you don't know how to install Ruby on your system.
40
+
41
+ ## Using Vagranfiles
42
+
43
+ [Installation using Vagrant](vagrant.md)
44
+ * If you plan to install Teuton into virtual machines, and have Vagrant installed into your real machine, this is the easier way for you.
45
+
46
+ ## Manual
47
+
48
+ [Manual installation](manual.md)
49
+ * If you don't need help, and want to install Teuton by your own, or there are not installation scripts for your favorite OS, and you don't want to use Vagrant then... here you have information how to install all the required packages for Teuton.
50
+
51
+ Let's us known your installation difficulties.
52
+
53
+ Thanks!
@@ -0,0 +1,38 @@
1
+
2
+ There are diferents Teuton [Modes of use](Modes of use). For every mode there are 2 node typesm and every node has their own installation script:
3
+
4
+ * **T-node**: This host has installed Teuton software.
5
+ * **S-node**: This host has installed SSH server.
6
+
7
+ ---
8
+ # T-NODE: Manual installation
9
+
10
+ 1. Git installation
11
+ * Install Git.
12
+ * Run `git --version` to show current version
13
+ 1. Ruby installation
14
+ * Install ruby.
15
+ * Run `ruby -v` to show current version (2.1.3p242+)
16
+ 1. Rake installation
17
+ * Run `gem install rake`, then
18
+ * `rake --version` to show current version (10.4.2+).
19
+ 1. Download this project
20
+ * (a) `git clone https://github.com/dvarrui/teuton.git` or
21
+ * (b) Download and unzip [file](https://github.com/dvarrui/teuton-panel/archive/master.zip).
22
+ 1. Move into Teuton folder
23
+ * Run `cd teuton`
24
+ 1. Gems installation.
25
+ * `rake install:gems`, to install required gems.
26
+ 1. Only for developers
27
+ * Run `rake install:debian` or
28
+ * `rake install:opensuse`, install gem for developers.
29
+ 1. Final check
30
+ * `rake`
31
+
32
+ ---
33
+
34
+ # S-NODE: Manual installation
35
+
36
+ * Install SSH server on your host.
37
+
38
+ > How to [install SSH on Windows](windows-ssh)
@@ -14,7 +14,7 @@ There are different Teuton [Modes of use](modes_of_use.md). For every mode there
14
14
  Run this command as `root` user:
15
15
 
16
16
  ```bash
17
- wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/bin/linux_t-node_install.sh | bash
17
+ wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/devel/install/linux/linux_t-node_install.sh | bash
18
18
  ```
19
19
 
20
20
  ## T-NODE: Mac OS X installation
@@ -22,7 +22,7 @@ wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/bin/li
22
22
  Run this command as admin user (member of `admin` group):
23
23
 
24
24
  ```bash
25
- curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/bin/macosx_t-node_install.sh | bash
25
+ curl -sL https://raw.githubusercontent.com/teuton-software/teuton/devel/install/mac/macosx_t-node_install.sh | bash
26
26
  ```
27
27
 
28
28
  > No `root` user.
@@ -36,7 +36,7 @@ Requirements:
36
36
  Run this command on **PowerShell (PS)** as `Administrator` user:
37
37
 
38
38
  ```powershell
39
- Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/bin/windows_t-node_install.ps1'))
39
+ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/devel/install/windows_t-node_install.ps1'))
40
40
  ```
41
41
 
42
42
  ---
@@ -52,7 +52,7 @@ This is, SSH server installation.
52
52
  Run this command as `root` user:
53
53
 
54
54
  ```bash
55
- wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/bin/linux_s-node_install.sh | bash
55
+ wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/devel/install/linux/linux_s-node_install.sh | bash
56
56
  ```
57
57
 
58
58
  ## S-NODE: Mac OS X installation
@@ -60,7 +60,7 @@ wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/bin/li
60
60
  Run this command as `root` user:
61
61
 
62
62
  ```bash
63
- curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/bin/macosx_s-node_install.sh | bash
63
+ curl -sL https://raw.githubusercontent.com/teuton-software/teuton/devel/install/mac/macosx_s-node_install.sh | bash
64
64
  ```
65
65
 
66
66
  ## S-NODE: Windows installation
@@ -72,5 +72,5 @@ Requirements:
72
72
  Run this command on **PowerShell (PS)** as `Administrator` user:
73
73
 
74
74
  ```powershell
75
- Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/bin/windows_s-node_install.ps1'))
75
+ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/devel/install/windows/windows_s-node_install.ps1'))
76
76
  ```
@@ -0,0 +1,25 @@
1
+ ## GNU/Linux
2
+
3
+ | O.S. | Version | Arch | T-node | S-node |
4
+ | --------- | -------------- | ------ | ------ | ------ |
5
+ | CentOS | 7 | x86-64 | | |
6
+ | Debian | 9.7.0 | x86-64 | Ok | |
7
+ | Fedora | Workstation 29 | x84-64 | Ok | |
8
+ | LinuxMint | 18.3 | x86-64 | Ok | |
9
+ | openSUSE | Leap 15 | x86-64 | Ok | Ok |
10
+ | Ubuntu | 18.04 | x86-64 | Ok | Ok |
11
+
12
+ ## Windows
13
+
14
+ | O.S. | Version | Arch | Nodo-T | Nodo-S |
15
+ | ------- | -------------- | ------ | ------ | ------ |
16
+ | Windows | 7 Enterprise | x86 | Ok | |
17
+ | Windows | 10 Pro | x86-64 | Ok | Ok |
18
+ | Windows | Server 2012 R2 | x86-64 | | |
19
+
20
+ ## Mac OS X
21
+
22
+ | O.S | Version | Arch | T-Node | S-Node |
23
+ | -------- | -------------------- | ------ | ------ | ------ |
24
+ | Mac OS X | El Capitán (10.11.6) | x86-64 | Ok | Ok |
25
+ | Mac OS X | Sierra (10.12) | x86-64 | Ok | |
@@ -0,0 +1,8 @@
1
+
2
+ # Install with Vagrant
3
+
4
+ * First, you must have `Vagrant` installed.
5
+ * Create directory for your vagrant project. For example, `mkdir teuton-vagrant`.
6
+ * Move into that directory: `cd teuton-vagrant`.
7
+ * Download required [Vagrantfile](../../install/vagrant).
8
+ * Run `vagrant up` to create your Virtual Machine.
File without changes
@@ -2,7 +2,7 @@
2
2
  Let's learn how to create our first target.
3
3
  A target is a feature you want to measure or check.
4
4
 
5
- > This example is on GitHub repository `teuton-challenge` at `learn/learn-01-target/`.
5
+ > This example is on GitHub repository at `examples/learn-01-target/`.
6
6
 
7
7
  ## Definitions (Group section)
8
8
 
@@ -2,7 +2,7 @@
2
2
  Learn how to use config file into your tests.
3
3
  Tests can use params defined into config files. It's good idea save variable data separated into external config file.
4
4
 
5
- > This example is on GitHub repository `teuton-challenge` at `learn/learn-02-config`.
5
+ > This example is on GitHub repository at `examples/learn-02-config`.
6
6
 
7
7
  ## Config file (`config.yaml`)
8
8
 
@@ -4,7 +4,7 @@ Learn how to:
4
4
  * Export reports using other output formats.
5
5
  * Checking remote machine (host1) with Windows OS.
6
6
 
7
- > This example is on GitHub repository `teuton-challenge` at `learn/learn-03-remote-hosts`.
7
+ > This example is on GitHub repository at `examples/learn-03-remote-hosts`.
8
8
 
9
9
  ## Config file (`config.yaml`)
10
10
 
@@ -3,7 +3,7 @@ Learn how to:
3
3
  * Organize huge amount of groups/targets into several files.
4
4
  * Checking Windows OS infrastructure (host1).
5
5
 
6
- > This example is on GitHub repository `teuton-challenge` at `learn/learn-04-use`.
6
+ > This example is on GitHub repository at `examples/learn-04-use`.
7
7
 
8
8
  ## Tree directory
9
9
 
@@ -3,7 +3,7 @@ Learn how to:
3
3
  * Check test syntax.
4
4
  * Debug your tests.
5
5
 
6
- > This example is on GitHub repository `teuton-challenge` at `learn/learn-05-debug`.
6
+ > This example is on GitHub repository at `examples/learn-05-debug`.
7
7
 
8
8
  ## Tree directory
9
9
 
@@ -4,7 +4,7 @@ require 'singleton'
4
4
  class Application
5
5
  include Singleton
6
6
 
7
- VERSION = '2.1.3' # Application version
7
+ VERSION = '2.1.4' # Application version
8
8
  NAME = 'teuton' # Application name
9
9
 
10
10
  attr_reader :letter
@@ -46,10 +46,12 @@ class Case
46
46
  private
47
47
 
48
48
  def search_alias(key, level)
49
- return search_array_alias(@ialias[key],level) if @ialias[key].class == Array
50
-
51
- return get(@ialias[key]) if [Integer, String, Symbol].include? @ialias[key].class
52
-
49
+ if @ialias[key].class == Array
50
+ return search_array_alias(@ialias[key], level)
51
+ elsif [Integer, String, Symbol].include? @ialias[key].class
52
+ return get(@ialias[key])
53
+ end
54
+
53
55
  words = key.to_s.split('_')
54
56
  return 'NODATA' if words.size < 2
55
57
 
@@ -61,14 +63,14 @@ class Case
61
63
  get("#{key2}_#{words[1]}".to_sym, level)
62
64
  end
63
65
 
64
- def search_array_alias(keys,level)
66
+ def search_array_alias(keys, level)
65
67
  values = []
66
68
  keys.each do |k|
67
69
  if k.class == Symbol
68
70
  values << get(k, level + 1)
69
- else
70
- values << k
71
+ next
71
72
  end
73
+ values << k
72
74
  end
73
75
  values.join('')
74
76
  end
@@ -2,7 +2,9 @@
2
2
 
3
3
  require_relative '../runner'
4
4
 
5
- # Case->DSL#goto
5
+ # Case class -> DSL module:
6
+ # * goto
7
+ # * run
6
8
  module DSL
7
9
  # Run command from the host identify as pHostname
8
10
  # goto :host1, :execute => "command"
@@ -13,21 +15,14 @@ module DSL
13
15
  tempfile(args[:tempfile]) if args[:tempfile]
14
16
  @action[:encoding] = args[:encoding] || 'UTF-8'
15
17
 
16
- protocol = @config.get("#{host}_protocol".to_sym)
17
- ip = @config.get("#{host}_ip".to_sym)
18
18
  start_time = Time.now
19
- if (protocol == 'NODATA' || protocol.nil?) &&
20
- (host.to_s == 'localhost' || host.to_s.include?('127.0.0.') || ip.include?('127.0.0.'))
21
- run_local_cmd
22
- elsif ip == 'NODATA'
23
- log("#{host} IP not found!", :error)
24
- else
25
- run_remote_cmd host
26
- end
19
+ run_cmd_on(host)
27
20
  @action[:duration] = (Time.now - start_time).round(3)
28
21
  end
29
22
  alias on goto
30
23
 
24
+ ##
25
+ # DLS run: It's the same as goto :localhost
31
26
  def run(command, args = {})
32
27
  args[:exec] = command.to_s
33
28
  goto(:localhost, args)
@@ -1,14 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # DSL#log
3
+ ##
4
+ # Case class -> DSL module : log function
4
5
  module DSL
6
+ ##
7
+ # Record log message
8
+ # @param text (String)
9
+ # @param type (Symbol) Values :info, :warn or :error
10
+ # rubocop:disable Style/FormatStringToken
5
11
  def log(text = '', type = :info)
6
12
  s = ''
7
13
  s = Rainbow('WARN!').color(:yellow) if type == :warn
8
14
  s = Rainbow('ERROR').bg(:red) if type == :error
9
15
  t = Time.now
10
- f = format('%02d:%02d:%02d', t.hour, t.min, t.sec)
16
+ # f = format('%02d:%02d:%02d', t.hour, t.min, t.sec)
17
+ f = '%02d:%02d:%02d' % [t.hour, t.min, t.sec]
11
18
  @report.lines << "[#{f}] #{s}: #{text}"
12
19
  end
20
+ # rubocop:enable Style/FormatStringToken
13
21
  alias msg log
14
22
  end
@@ -2,6 +2,7 @@
2
2
  require 'net/ssh'
3
3
  require 'net/sftp'
4
4
  require 'net/telnet'
5
+ require_relative 'dsl/log'
5
6
 
6
7
  # Class Case
7
8
  # * run_local_cmd
@@ -12,14 +13,38 @@ class Case
12
13
 
13
14
  private
14
15
 
15
- def run_local_cmd()
16
+ def run_cmd_on(host)
17
+ protocol = @config.get("#{host}_protocol".to_sym)
18
+ ip = @config.get("#{host}_ip".to_sym)
19
+
20
+ if (protocol.to_s.downcase == 'local' || host.to_s == 'localhost')
21
+ run_cmd_localhost() # Protocol force => local
22
+ elsif protocol.to_s.downcase == 'ssh'
23
+ run_cmd_remote_ssh(host) # Protocol force => ssh
24
+ elsif protocol.to_s.downcase == 'telnet'
25
+ run_cmd_remote_telnet(host) # Protocol force => telnet
26
+ elsif (ip.to_s.downcase == 'localhost' || ip.to_s.include?('127.0.0.'))
27
+ run_cmd_localhost()
28
+ elsif ip == 'NODATA'
29
+ log("#{host} IP not found!", :error)
30
+ else
31
+ run_cmd_remote_ssh host
32
+ end
33
+ end
34
+
35
+ ##
36
+ # Run command on local machine
37
+ def run_cmd_localhost()
16
38
  @action[:conn_type] = :local
17
39
  i = my_execute( @action[:command], @action[:encoding] )
18
40
  @result.exitstatus = i[:exitstatus]
19
41
  @result.content = i[:content]
20
42
  end
21
43
 
22
- def run_remote_cmd(input_hostname)
44
+ ##
45
+ # Run remote command
46
+ # @param input_hostname (Symbol or String)
47
+ def run_cmd_remote(input_hostname)
23
48
  hostname = input_hostname.to_s
24
49
  i = (hostname + '_protocol').to_sym
25
50
  protocol = @config.get(i) if @config.get(i)
@@ -27,15 +52,17 @@ class Case
27
52
  protocol = protocol.to_sym
28
53
  case protocol
29
54
  when :ssh
30
- run_remote_cmd_ssh(input_hostname)
55
+ run_cmd_remote_ssh(input_hostname)
31
56
  when :telnet
32
- run_remote_cmd_telnet(input_hostname)
57
+ run_cmd_remote_telnet(input_hostname)
58
+ when :local
59
+ run_cmd_localhost()
33
60
  else
34
61
  log("Protocol #{protocol} unknown! Use ssh or telnet.", :error)
35
62
  end
36
63
  end
37
64
 
38
- def run_remote_cmd_ssh(input_hostname)
65
+ def run_cmd_remote_ssh(input_hostname)
39
66
  @action[:conn_type] = :ssh
40
67
  hostname = input_hostname.to_s
41
68
  ip = @config.get((hostname + '_ip').to_sym)
@@ -86,7 +113,7 @@ class Case
86
113
  @result.content.compact!
87
114
  end
88
115
 
89
- def run_remote_cmd_telnet(input_hostname)
116
+ def run_cmd_remote_telnet(input_hostname)
90
117
  @action[:conn_type] = :telnet
91
118
  app = Application.instance
92
119
  hostname = input_hostname.to_s
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative '../application'
3
4
 
4
5
  # CaseManager#show
@@ -13,9 +13,10 @@ module Utils
13
13
  true
14
14
  end
15
15
 
16
+ # rubocop:disable Metrics/MethodLength
16
17
  def encode_and_split(encoding, text)
17
18
  # Convert text to UTF-8 deleting unknown chars
18
- text = text || '' # Ensure text is not nil
19
+ text ||= '' # Ensure text is not nil
19
20
  flag = [:default, 'UTF-8'].include? encoding
20
21
  return text.encode('UTF-8', invalid: :replace).split("\n") if flag
21
22
 
@@ -30,6 +31,7 @@ module Utils
30
31
 
31
32
  text.split("\n")
32
33
  end
34
+ # rubocop:enable Metrics/MethodLength
33
35
 
34
36
  def my_execute(cmd, encoding = 'UTF-8')
35
37
  return { exitstatus: 0, content: '' } if Application.instance.debug
@@ -3,5 +3,4 @@
3
3
  require_relative 'play'
4
4
  require_relative 'readme'
5
5
  require_relative 'test'
6
- require_relative 'update'
7
6
  require_relative 'version'
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Teuton#play
4
- class TeutonCommand < Thor
5
- map ['p', '-p', 'play', '--play'] => 'play'
3
+ # CLI#play
4
+ class CLI < Thor
5
+ map ['p', '-p', 'play', '--play', '--run', 'run'] => 'play'
6
6
  option :export, type: :string
7
7
  option :cname, type: :string
8
8
  option :cpath, type: :string
9
9
  option :case, type: :string
10
10
  option :quiet, type: :boolean
11
- desc '[play] [OPTIONS] DIRECTORY',
11
+ desc '[run] [OPTIONS] DIRECTORY',
12
12
  'Run challenge from directory'
13
13
  long_desc <<-LONGDESC
14
14
  This function execute challenge from specified directory.
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Teuton#readme
4
- class TeutonCommand < Thor
5
- map ['r', '-r', '--readme'] => 'readme'
3
+ # CLI#readme
4
+ class CLI < Thor
5
+ map ['--readme'] => 'readme'
6
6
  option :lang, type: :string
7
7
  desc 'readme DIRECTORY',
8
8
  'Create README.md file from challenge contents'
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Teuton#test
4
- class TeutonCommand < Thor
5
- map ['t', '-t', '--test'] => 'test'
3
+ # CLI#test
4
+ class CLI < Thor
5
+ map ['t', '-t', '--test', 'test'] => 'check'
6
6
  option :c, type: :boolean
7
7
  option :cname, type: :string
8
8
  option :cpath, type: :string
9
- desc 'test [OPTIONS] DIRECTORY',
9
+ desc 'check [OPTIONS] DIRECTORY',
10
10
  'Test or check challenge contents'
11
11
  long_desc <<-LONGDESC
12
12
 
@@ -32,7 +32,7 @@ class TeutonCommand < Thor
32
32
  ##
33
33
  # Verify or test Teuton test units syntax
34
34
  # @param path_to_rb_file [String] Route to main rb Teuton file
35
- def test(path_to_rb_file)
35
+ def check(path_to_rb_file)
36
36
  Project.test(path_to_rb_file, options)
37
37
  end
38
38
  end
@@ -3,9 +3,11 @@
3
3
  require 'rainbow'
4
4
 
5
5
  # Class method Teuton#version
6
- class TeutonCommand < Thor
6
+ class CLI < Thor
7
7
  map ['v', '-v', '--version'] => 'version'
8
8
  desc 'version', 'Show the program version'
9
+ ##
10
+ # Display version
9
11
  def version
10
12
  print Rainbow(Application::NAME).bright.blue
11
13
  puts ' (version ' + Rainbow(Application::VERSION).green + ')'
@@ -1,24 +1,16 @@
1
1
  require 'thor'
2
2
  require_relative 'application'
3
3
  require_relative 'project/project'
4
- require_relative 'project/project_creator.rb'
5
- require_relative 'command/main'
4
+ require_relative 'project/skeleton.rb'
5
+ require_relative 'cli/main'
6
6
 
7
7
  ##
8
8
  # Command Line User Interface
9
- class TeutonCommand < Thor
9
+ class CLI < Thor
10
10
  map ['h', '-h', '--help'] => 'help'
11
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'
12
+ map ['c', '-c', '--create', 'create'] => 'new'
13
+ desc 'new DIRECTORY', 'Create skeleton for a new project'
22
14
  long_desc <<-LONGDESC
23
15
  Create files for a new project.
24
16
 
@@ -27,8 +19,20 @@ class TeutonCommand < Thor
27
19
  #{$PROGRAM_NAME} create dir/foo
28
20
  LONGDESC
29
21
  ##
30
- # Command create new Teuton project
31
- def create(path_to_new_dir)
32
- ProjectCreator.create(path_to_new_dir)
22
+ # Command: create new Teuton project
23
+ def new(path_to_new_dir)
24
+ Skeleton.create(path_to_new_dir)
25
+ end
26
+
27
+ ##
28
+ # These inputs are equivalents:
29
+ # * teuton dir/foo
30
+ # * teuton play dir/foo
31
+ def method_missing(method, *_args, &_block)
32
+ play(method.to_s)
33
+ end
34
+
35
+ def respond_to_missing?(method_name, include_private = false)
36
+ super
33
37
  end
34
38
  end
@@ -9,21 +9,31 @@ require_relative 'show'
9
9
  require_relative 'dsl'
10
10
  require_relative 'builtin'
11
11
 
12
+ ##
13
+ # DSL use: import filename instructions
14
+ # @param filename (String)
12
15
  def use(filename)
13
16
  filename += '.rb'
14
17
  app = Application.instance
15
- rbfiles = File.join(app.project_path, "**", filename)
18
+ rbfiles = File.join(app.project_path, '**', filename)
16
19
  files = Dir.glob(rbfiles)
17
20
  use = []
18
21
  files.sort.each { |f| use << f if f.include?(filename) }
19
22
  require_relative use[0]
20
23
  end
21
24
 
25
+ ##
26
+ # DSL group: Define a group of test
27
+ # @param name (String or Symbol)
28
+ # @param block (Proc)
22
29
  def group(name, &block)
23
30
  Application.instance.groups << { name: name, block: block }
24
31
  end
25
32
  alias task group
26
33
 
34
+ ##
35
+ # DSL start: Define main teuton test execution
36
+ # @param block (Proc)
27
37
  def start(&block)
28
38
  # don't do nothing
29
39
  end
@@ -33,10 +33,10 @@ module Project
33
33
 
34
34
  def self.process_input_case_option
35
35
  options = Application.instance.options
36
- unless options['case'].nil?
37
- a = options['case'].split(',')
38
- options['case'] = a.collect! { |i| i.to_i }
39
- end
36
+ return if options['case'].nil?
37
+
38
+ a = options['case'].split(',')
39
+ options['case'] = a.collect!(&:to_i)
40
40
  end
41
41
 
42
42
  def self.readme(pathtofile, options)
@@ -31,21 +31,21 @@ class Readme
31
31
  unless host == :localhost
32
32
  b = {}
33
33
  a = "#{host}_ip".to_sym
34
- if @config[:global][a].nil? && (not @setted_params.include?(a))
34
+ if @config[:global][a].nil? && !@setted_params.include?(a)
35
35
  @cases_params << a
36
36
  end
37
37
  b[:ip] = @config[:global][a] if @config[:global][a]
38
38
  b[:ip] = @setted_params[a] if @setted_params[a]
39
39
 
40
40
  a = "#{host}_username".to_sym
41
- if @config[:global][a].nil? && (not @setted_params.include?(a))
41
+ if @config[:global][a].nil? && !@setted_params.include?(a)
42
42
  @cases_params << a
43
43
  end
44
44
  b[:username] = @config[:global][a] if @config[:global][a]
45
45
  b[:username] = @setted_params[a] if @setted_params[a]
46
46
 
47
47
  a = "#{host}_password".to_sym
48
- if @config[:global][a].nil? && (not @setted_params.include?(a))
48
+ if @config[:global][a].nil? && !@setted_params.include?(a)
49
49
  @cases_params << a
50
50
  end
51
51
  b[:password] = @config[:global][a] if @config[:global][a]
@@ -62,7 +62,7 @@ class Readme
62
62
  goto(:localhost, args)
63
63
  end
64
64
 
65
- def expect(_cond, args = {})
65
+ def expect(_cond, _args = {})
66
66
  @current[:actions] << @action
67
67
  result.reset
68
68
  end
@@ -92,6 +92,7 @@ class Readme
92
92
  a = get(value)
93
93
  return "[#{value}](\#required-params)" if @cases_params.include? value
94
94
  return "[#{value}](\#created-params)" if @setted_params[value]
95
+
95
96
  "[#{a}](\#global-params)" if @global_params.include? value
96
97
  end
97
98
 
@@ -6,7 +6,7 @@ module Lang
6
6
  lang = {}
7
7
  lang['en'] = {
8
8
  version: 'Teuton version : %s',
9
- testname: 'Challenge name : %s',
9
+ testname: 'Test unit name : %s',
10
10
  date: 'Date : %s',
11
11
  hosts: "\n\#\#\# Required hosts\n",
12
12
  params: "\n\#\#\# Required params\n",
@@ -16,7 +16,7 @@ module Lang
16
16
  }
17
17
  lang['es'] = {
18
18
  version: 'Versión de Teuton : %s',
19
- testname: 'Nombre del reto : %s',
19
+ testname: 'Nombre del test : %s',
20
20
  date: 'Fecha : %s',
21
21
  hosts: "\n\#\#\# Máquinas que se necesitan\n",
22
22
  params: "\n\#\#\# Parámetros de necesarios\n",
@@ -107,6 +107,7 @@ class Readme
107
107
  puts format(Lang::get(:date), Time.now)
108
108
  puts format(Lang::get(:version), Application::VERSION)
109
109
  puts '```'
110
+ puts "\n---\n"
110
111
  puts "# README.md\n"
111
112
 
112
113
  i = 1
@@ -3,23 +3,20 @@
3
3
  require 'fileutils'
4
4
  require 'rainbow'
5
5
 
6
- # Project#create
6
+ # Skeleton class
7
7
  # * create
8
8
  # * create_main_dir_and_files
9
9
  # * create_assets_dir_and_files
10
10
  # * create_dir
11
11
  # * create_dirs
12
12
  # * copyfile
13
- module ProjectCreator
13
+ module Skeleton
14
14
  def self.create(project_dir)
15
15
  project_name = File.basename(project_dir)
16
16
  puts "\n[INFO] Creating #{Rainbow(project_name).bright} project skeleton"
17
-
18
17
  source_basedir = File.join(File.dirname(__FILE__), '..')
19
18
  create_dir project_dir
20
-
21
19
  create_main_dir_and_files(project_dir, source_basedir)
22
- create_assets_dir_and_files(project_dir, source_basedir)
23
20
  end
24
21
 
25
22
  def self.create_main_dir_and_files(project_dir, source_basedir)
@@ -27,7 +24,7 @@ module ProjectCreator
27
24
  items = [
28
25
  { source: 'files/config.yaml', target: 'config.yaml' },
29
26
  { source: 'files/start.rb', target: 'start.rb' },
30
- { source: 'files/README.md', target: 'README.md' },
27
+ # { source: 'files/README.md', target: 'README.md' },
31
28
  { source: 'files/gitignore', target: '.gitignore' }
32
29
  ]
33
30
  items.each do |item|
@@ -37,16 +34,6 @@ module ProjectCreator
37
34
  end
38
35
  end
39
36
 
40
- def self.create_assets_dir_and_files(project_dir, source_basedir)
41
- # Assets Directory and files
42
- project_assets_dir = File.join(project_dir, 'assets')
43
- create_dir project_assets_dir
44
- # source = File.join(source_basedir, 'lib/files/README.md')
45
- # target = File.join(project_dir, 'README.md')
46
- # copyfile(source, target) # README.md
47
- puts ''
48
- end
49
-
50
37
  def self.create_dir(dirpath)
51
38
  if Dir.exist? dirpath
52
39
  puts "* Exists dir! => #{Rainbow(dirpath).yellow}"
data/lib/teuton.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require_relative 'teuton/application'
2
2
  require_relative 'teuton/project/project'
3
- require_relative 'teuton/project/project_creator'
3
+ require_relative 'teuton/project/skeleton'
4
4
 
5
5
  ##
6
6
  # Main Teuton functions
@@ -8,7 +8,7 @@ module Teuton
8
8
  ##
9
9
  # Create new Teuton project
10
10
  def self.create(path_to_new_dir)
11
- ProjectCreator.create(path_to_new_dir)
11
+ Skeleton.create(path_to_new_dir)
12
12
  end
13
13
 
14
14
  ##
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.1.3
4
+ version: 2.1.4
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: 2020-02-09 00:00:00.000000000 Z
11
+ date: 2020-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_pure
@@ -156,11 +156,11 @@ extra_rdoc_files:
156
156
  - docs/learn/example-05-debug.md
157
157
  - docs/learn/example-11-first-test.md
158
158
  - docs/learn/videos.md
159
- - docs/learn/learning.md
160
159
  - docs/learn/example-02-configfile.md
161
160
  - docs/learn/example-04-use.md
162
161
  - docs/learn/quick-demo.md
163
162
  - docs/learn/example-01-target.md
163
+ - docs/learn/README.md
164
164
  - docs/changelog/v2.1.md
165
165
  - docs/changelog/todo.md
166
166
  - docs/changelog/servidor-de-retos.md
@@ -169,7 +169,7 @@ extra_rdoc_files:
169
169
  - docs/commands/help.md
170
170
  - docs/commands/revise_test.md
171
171
  - docs/commands/create_skeleton.md
172
- - docs/commands/commands.md
172
+ - docs/commands/README.md
173
173
  - docs/commands/run_test_unit.md
174
174
  - docs/dsl/definition/run.md
175
175
  - docs/dsl/definition/goto.md
@@ -177,7 +177,6 @@ extra_rdoc_files:
177
177
  - docs/dsl/definition/target.md
178
178
  - docs/dsl/definition/group.md
179
179
  - docs/dsl/definition/expect.md
180
- - docs/dsl/keywords.md
181
180
  - docs/dsl/execution/export.md
182
181
  - docs/dsl/execution/play.md
183
182
  - docs/dsl/execution/send.md
@@ -185,17 +184,18 @@ extra_rdoc_files:
185
184
  - docs/dsl/_Sidebar.md
186
185
  - docs/dsl/setting/set.md
187
186
  - docs/dsl/setting/get.md
187
+ - docs/dsl/README.md
188
188
  - docs/Challenge-Server-Project.md
189
189
  - docs/developers/comparative.md
190
190
  - docs/developers/03-encoding.md
191
191
  - docs/developers/01-telnet.md
192
192
  - docs/developers/02-ssh.md
193
+ - docs/install/vagrant.md
193
194
  - docs/install/modes_of_use.md
194
- - docs/install/tested_od.md
195
- - docs/install/vagrant_install.md
196
- - docs/install/scripts_install.md
197
- - docs/install/manual_install.md
198
- - docs/install/install.md
195
+ - docs/install/tested_os.md
196
+ - docs/install/scripts.md
197
+ - docs/install/README.md
198
+ - docs/install/manual.md
199
199
  files:
200
200
  - LICENSE
201
201
  - README.md
@@ -205,7 +205,7 @@ files:
205
205
  - docs/changelog/todo.md
206
206
  - docs/changelog/v2.0.md
207
207
  - docs/changelog/v2.1.md
208
- - docs/commands/commands.md
208
+ - docs/commands/README.md
209
209
  - docs/commands/create_skeleton.md
210
210
  - docs/commands/help.md
211
211
  - docs/commands/revise_test.md
@@ -215,6 +215,7 @@ files:
215
215
  - docs/developers/02-ssh.md
216
216
  - docs/developers/03-encoding.md
217
217
  - docs/developers/comparative.md
218
+ - docs/dsl/README.md
218
219
  - docs/dsl/_Sidebar.md
219
220
  - docs/dsl/definition/expect.md
220
221
  - docs/dsl/definition/goto.md
@@ -226,22 +227,21 @@ files:
226
227
  - docs/dsl/execution/play.md
227
228
  - docs/dsl/execution/send.md
228
229
  - docs/dsl/execution/show.md
229
- - docs/dsl/keywords.md
230
230
  - docs/dsl/setting/get.md
231
231
  - docs/dsl/setting/set.md
232
- - docs/install/install.md
233
- - docs/install/manual_install.md
232
+ - docs/install/README.md
233
+ - docs/install/manual.md
234
234
  - docs/install/modes_of_use.md
235
- - docs/install/scripts_install.md
236
- - docs/install/tested_od.md
237
- - docs/install/vagrant_install.md
235
+ - docs/install/scripts.md
236
+ - docs/install/tested_os.md
237
+ - docs/install/vagrant.md
238
+ - docs/learn/README.md
238
239
  - docs/learn/example-01-target.md
239
240
  - docs/learn/example-02-configfile.md
240
241
  - docs/learn/example-03-remote-hosts.md
241
242
  - docs/learn/example-04-use.md
242
243
  - docs/learn/example-05-debug.md
243
244
  - docs/learn/example-11-first-test.md
244
- - docs/learn/learning.md
245
245
  - docs/learn/quick-demo.md
246
246
  - docs/learn/videos.md
247
247
  - lib/teuton.rb
@@ -280,13 +280,12 @@ files:
280
280
  - lib/teuton/case_manager/report.rb
281
281
  - lib/teuton/case_manager/show.rb
282
282
  - lib/teuton/case_manager/utils.rb
283
- - lib/teuton/command.rb
284
- - lib/teuton/command/main.rb
285
- - lib/teuton/command/play.rb
286
- - lib/teuton/command/readme.rb
287
- - lib/teuton/command/test.rb
288
- - lib/teuton/command/update.rb
289
- - lib/teuton/command/version.rb
283
+ - lib/teuton/cli.rb
284
+ - lib/teuton/cli/main.rb
285
+ - lib/teuton/cli/play.rb
286
+ - lib/teuton/cli/readme.rb
287
+ - lib/teuton/cli/test.rb
288
+ - lib/teuton/cli/version.rb
290
289
  - lib/teuton/files/README.md
291
290
  - lib/teuton/files/config.yaml
292
291
  - lib/teuton/files/gitignore
@@ -298,12 +297,10 @@ files:
298
297
  - lib/teuton/project/laboratory/show.rb
299
298
  - lib/teuton/project/name_file_finder.rb
300
299
  - lib/teuton/project/project.rb
301
- - lib/teuton/project/project_creator.rb
302
300
  - lib/teuton/project/readme/dsl.rb
303
301
  - lib/teuton/project/readme/lang.rb
304
302
  - lib/teuton/project/readme/readme.rb
305
- - lib/teuton/rake_function/check.rb
306
- - lib/teuton/rake_function/install.rb
303
+ - lib/teuton/project/skeleton.rb
307
304
  - lib/teuton/report/close.rb
308
305
  - lib/teuton/report/formatter/array_formatter.rb
309
306
  - lib/teuton/report/formatter/base_formatter.rb
@@ -328,7 +325,7 @@ homepage: https://github.com/teuton-software/teuton
328
325
  licenses:
329
326
  - GPL-3.0
330
327
  metadata: {}
331
- post_install_message:
328
+ post_install_message: Thanks for installing!
332
329
  rdoc_options: []
333
330
  require_paths:
334
331
  - lib
@@ -1,32 +0,0 @@
1
-
2
- > We recommend you, start reading about [Modes of use](modes_of_use.md), and learn the differences between T-node and S-node before installation.
3
-
4
- ---
5
- # Installation
6
-
7
- **T-NODE installation**: Install Teuton on machine with T-NODE role.
8
- Installation process:
9
-
10
- 1. Install Ruby on your system.
11
- 2. `gem install teuton`
12
-
13
- Run `teuton version` to check that your installation is ok.
14
-
15
- **S-NODE installation**: Install SSH server on every machine with S-NODE role.
16
-
17
- ---
18
- # Other installation ways
19
-
20
- [Installation using scripts](scripts_install.md)
21
- * Use our scripts to run automatical installation for your OS.
22
- * Use this way if you don't know how to install Ruby on your system.
23
-
24
- [Installation using Vagrant](vagrant_install.md)
25
- * If you plan to install Teuton into virtual machines, and have Vagrant installed into your real machine, this is the easier way for you.
26
-
27
- [Manual installation](manual_install.md)
28
- * If you don't need help, and want to install Teuton by your own, or there are not installation scripts for your favorite OS, and you don't want to use Vagrant then... here you have information how to install all the required packages for Teuton.
29
-
30
- Let's us known your installation difficulties.
31
-
32
- Thanks!
@@ -1,25 +0,0 @@
1
- There are diferents Teuton [Modes of use](Modes of use). For every mode there are 2 node typesm and every node has their own installation script:
2
-
3
- * **T-node**: This host has installed Teuton software.
4
- * **S-node**: This host has installed SSH server.
5
-
6
- ---
7
-
8
- # T-NODE: Manual installation
9
-
10
- | ID | Action | Details |
11
- | -- | ----------------- | ----------- |
12
- | 1 | Git installation | Run `git --version` to show current version |
13
- | 2 | Ruby installation | Run `ruby -v` to show current version (2.1.3p242+) |
14
- | 3 | Rake installation | Run `gem install rake`, then `rake --version` to show current version (10.4.2+). |
15
- | 4 | Download this project | (a) `git clone https://github.com/dvarrui/teuton.git` (b) Download and unzip [file](https://github.com/dvarrui/teuton-panel/archive/master.zip). |
16
- | 5 | Gems installation | Run `cd teuton` and `rake gems` |
17
- | 6 | Final check | `rake` |
18
-
19
- ---
20
-
21
- # S-NODE: Manual installation
22
-
23
- * Install SSH server on your host.
24
-
25
- > How to [install SSH on Windows](windows-ssh)
@@ -1,25 +0,0 @@
1
- ## GNU/Linux
2
-
3
- | O.S. | Version | Arch | T-node | S-node |
4
- | --------- | -------------- | ------ | ------ | ------ |
5
- | CentOS | 7 | x86-64 | [?] | [?] |
6
- | Debian | 9.7.0 | x86-64 | [X] | [?] |
7
- | Fedora | Workstation 29 | x84-64 | [?] | [?] |
8
- | LinuxMint | 18.3 | x86-64 | [X] | [?] |
9
- | openSUSE | Leap 15 | x86-64 | [X] | [X] |
10
- | Ubuntu | 18.04 | x86-64 | [X] | [X] |
11
-
12
- ## Windows
13
-
14
- | O.S. | Version | Arch | Nodo-T | Nodo-S |
15
- | ------- | -------------- | ------ | ------ | ------ |
16
- | Windows | 7 Enterprise | x86 | [X] | [?] |
17
- | Windows | 10 Pro | x86-64 | [X] | [X] |
18
- | Windows | Server 2012 R2 | x86-64 | [?] | [?] |
19
-
20
- ## Mac OS X
21
-
22
- | O.S | Version | Arch | T-Node | S-Node |
23
- | -------- | -------------------- | ------ | ------ | ------ |
24
- | Mac OS X | El Capitán (10.11.6) | x86-64 | [X] | [X] |
25
- | Mac OS X | Sierra (10.12) | x86-64 | [X] | [?] |
@@ -1,15 +0,0 @@
1
- * First, you must have `Vagrant` installed.
2
- * Create directory for your vagrant project. For example, `mkdir teuton-vagrant`.
3
- * Move into that directory: `cd teuton-vagrant`.
4
- * Download required Vagrantfile:
5
-
6
- | Vagrantfile | URL |
7
- | ------------------ | ----|
8
- | T-Node OpenSUSE VM | https://raw.githubusercontent.com/teuton-software/vagrant/master/t-node/opensuse/Vagrantfile |
9
- | S-Node OpenSUSE VM | https://raw.githubusercontent.com/teuton-software/vagrant/master/s-node/opensuse/Vagrantfile |
10
-
11
- * Run `vagrant up` to run the Virtual Machine.
12
-
13
- **Notice:** If you plan to build T-node and S-node VMs, then you need to use separated directories for every Vagranfile.
14
-
15
- > There are more Vagrantfile files for others OS at https://github.com/teuton-software/vagrant/ repository.
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rainbow'
4
-
5
- # Class method Teuton#update
6
- class TeutonCommand < Thor
7
- map ['--update', '-u', 'u'] => 'update'
8
- desc 'update', 'Update TEUTON from git repo'
9
- long_desc <<-LONGDESC
10
- Update TEUTON project, downloading files from git repo.
11
- Execute "cd PATH/TO/TEUTON/DIR && git pull".
12
-
13
- Alias: teuton u, teuton -u, teuton --update
14
-
15
- LONGDESC
16
- def update
17
- dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..'))
18
- ok = system("cd #{dir} && git pull")
19
- if ok
20
- puts Rainbow('[ OK ] teuton update').green.bright
21
- exit(0)
22
- else
23
- puts Rainbow('[FAIL] teuton update').red.bright
24
- exit(1)
25
- end
26
- end
27
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Method RakeFunction#check
4
- module RakeFunction
5
- def self.check(gems)
6
- puts "[INFO] Version #{Application::VERSION}"
7
- check_gems gems
8
- check_tests
9
- end
10
-
11
- def self.check_gems(gems)
12
- fails = filter_uninstalled_gems(gems)
13
- puts "[ERROR] Gems to install!: #{fails.join(',')}" unless fails == []
14
- end
15
-
16
- def self.check_tests
17
- testfile = File.join('.', 'tests', 'all.rb')
18
- a = File.read(testfile).split("\n")
19
- b = a.select { |i| i.include? '_test' }
20
-
21
- d = File.join('.', 'tests', '**', '*_test.rb')
22
- e = Dir.glob(d)
23
-
24
- unless b.size == e.size
25
- puts "[FAIL] Some ruby tests are not executed by #{testfile}"
26
- end
27
-
28
- puts "[INFO] Running #{testfile}"
29
- system(testfile)
30
- end
31
-
32
- def self.filter_uninstalled_gems(list)
33
- cmd = `gem list`.split("\n")
34
- names = cmd.map { |i| i.split(' ')[0] }
35
- fails = []
36
- list.each { |i| fails << i unless names.include?(i) }
37
- fails
38
- end
39
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Methods Module RakeFunction
4
- # * opensuse
5
- # * debian
6
- # * install_gems
7
- module RakeFunction
8
- def self.opensuse(packages)
9
- names = %w[openssh make gcc ruby-dev]
10
- options = '--non-interactive'
11
- names.each do |n|
12
- system("zypper #{options} install #{n}")
13
- end
14
- install_gems packages, '--no-ri'
15
- create_symbolic_link
16
- end
17
-
18
- def self.debian(packages)
19
- names = %w[ssh make gcc ruby-dev]
20
- names.each { |name| system("apt-get install -y #{name}") }
21
- install_gems packages, '--no-ri'
22
- create_symbolic_link
23
- end
24
-
25
- def self.install_gems(list, options = '')
26
- fails = filter_uninstalled_gems(list)
27
- if !fails.empty?
28
- puts "[INFO] Installing gems (options = #{options})..."
29
- fails.each do |name|
30
- system("gem install #{name} #{options}")
31
- end
32
- else
33
- puts '[ OK ] Gems installed'
34
- end
35
- end
36
- end