teuton-client 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/teuton-client/application.rb +3 -1
- data/lib/teuton-client/input_loader.rb +16 -1
- data/lib/teuton-client.rb +67 -46
- metadata +15 -3
- data/lib/teuton-client/files/teuton-client.yaml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a203d38e3c901593af699ca06643e6ca7e538b86806bdcff4c37038c1c4028c9
|
4
|
+
data.tar.gz: 4e2e689e75d667cb93fa196f9bb26aa23d0cd1f731f175224653e297463c833f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 865955fe009912dc5d54a5032565400f13294af53b34e5f2109fb6d54969318219be9abe3f2d7450eca90a70ec1fc6dc6f557784ce01e6df0ca7c915e18893a9
|
7
|
+
data.tar.gz: e58c0d2613a10879703c0f943b5b28cebc5ff3e2c5ec7eb05c82b5309e03c0e201c35b8771a9f988f9eef9f5981bb71872aa8974b6693d971234a366c6f0ddf7
|
@@ -1,8 +1,19 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require_relative 'application'
|
3
3
|
|
4
|
+
##
|
5
|
+
# Methods that read config params
|
4
6
|
module InputLoader
|
5
|
-
|
7
|
+
##
|
8
|
+
# Read input arguments and return config params.
|
9
|
+
# Arguments:
|
10
|
+
# * YAML file => Read file.yaml as config file
|
11
|
+
# * Empty
|
12
|
+
# * Exist default config file => Read config file
|
13
|
+
# * Dosn't exist config file => Set defaults IP, PORT values
|
14
|
+
# @param input [Array] Input ARGVS
|
15
|
+
# @return [String, Integer] Server IP and Server PORT
|
16
|
+
def self.read_configuration(input)
|
6
17
|
if input.size.zero? && File.exists?(Application::CONFIGFILE)
|
7
18
|
param = read_yaml(Application::CONFIGFILE)
|
8
19
|
return param[:server][:ip], param[:server][:port]
|
@@ -12,6 +23,10 @@ module InputLoader
|
|
12
23
|
return ip, port
|
13
24
|
end
|
14
25
|
|
26
|
+
##
|
27
|
+
# Read YAML configuration file.
|
28
|
+
# @param filepath [String] Path to YAML config file.
|
29
|
+
# @return [Hash] YAML file content.
|
15
30
|
def self.read_yaml(filepath)
|
16
31
|
unless File.exists? filepath
|
17
32
|
puts "teuton-client => " +
|
data/lib/teuton-client.rb
CHANGED
@@ -4,58 +4,79 @@ require 'socket'
|
|
4
4
|
require_relative 'teuton-client/input_loader'
|
5
5
|
require_relative 'teuton-client/application'
|
6
6
|
|
7
|
+
##
|
8
|
+
# This module main methods to run Teuton Client
|
7
9
|
module TeutonClient
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"#{hostname}:#{port} (teuton-server)").bright
|
18
|
-
begin
|
19
|
-
s = TCPSocket.open(hostname, port)
|
20
|
-
rescue
|
21
|
-
puts Rainbow("teuton-client => " +
|
22
|
-
"ERROR teuton-server not found!" +
|
23
|
-
" [#{hostname}:#{port}]").bright.red
|
24
|
-
exit 1
|
10
|
+
class << self
|
11
|
+
##
|
12
|
+
# Run Teuton Client
|
13
|
+
# @param args [Array] Input arguments
|
14
|
+
# @return [Exit status]
|
15
|
+
def run(args)
|
16
|
+
hostname, port = InputLoader.read_configuration(args)
|
17
|
+
connect_to_server(hostname, port)
|
18
|
+
exit 0
|
25
19
|
end
|
26
|
-
|
27
|
-
|
20
|
+
|
21
|
+
##
|
22
|
+
# Show TeutonClient help.
|
23
|
+
# @return [Exit status]
|
24
|
+
def show_help
|
25
|
+
puts "Usage:"
|
26
|
+
puts " teuton-client [help|version] [IP PORT]"
|
27
|
+
puts "Params:"
|
28
|
+
puts " help , Show this help"
|
29
|
+
puts " init , Create \'#{Application::CONFIGFILE}\' config file"
|
30
|
+
puts " IP PORT , Teuton server IP and/or PORT"
|
31
|
+
puts " version , Show current version"
|
32
|
+
exit 0
|
28
33
|
end
|
29
|
-
s.close # Close the socket when done
|
30
|
-
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
exit 0
|
41
|
-
end
|
35
|
+
##
|
36
|
+
# Show TeutonClient version
|
37
|
+
# @return [Exit status]
|
38
|
+
def show_version
|
39
|
+
puts "teuton-client => " +
|
40
|
+
Rainbow("version #{Application::VERSION}").cyan
|
41
|
+
exit 0
|
42
|
+
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
##
|
45
|
+
# Create default configuration file 'teuton-client.yaml'.
|
46
|
+
# @return [Exit status]
|
47
|
+
def init
|
48
|
+
src = File.join(File.dirname(__FILE__), 'teuton-client', 'files',
|
49
|
+
Application::CONFIGFILE)
|
50
|
+
dest = File.join(Application::CONFIGFILE)
|
51
|
+
if File.exists? dest
|
52
|
+
puts "teuton-client => " + Rainbow("File \'#{dest}\' exists!").red
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
FileUtils.cp(src, dest)
|
56
|
+
puts "teuton-client => " + Rainbow("Init \'#{dest}\' done!").yellow
|
57
|
+
exit 0
|
58
|
+
end
|
48
59
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
private
|
61
|
+
##
|
62
|
+
# Connect client to server and display server response.
|
63
|
+
# @param hostname [String] Server hostname or IP
|
64
|
+
# @param port [Integer] Server listening port
|
65
|
+
def connect_to_server(hostname='localhost', port=16000)
|
66
|
+
puts Rainbow("teuton-client => Waiting... " +
|
67
|
+
"#{hostname}:#{port} (teuton-server)").bright
|
68
|
+
begin
|
69
|
+
s = TCPSocket.open(hostname, port)
|
70
|
+
rescue
|
71
|
+
puts Rainbow("teuton-client => " +
|
72
|
+
"ERROR teuton-server not found!" +
|
73
|
+
" [#{hostname}:#{port}]").bright.red
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
while line = s.gets # Read lines from the socket
|
77
|
+
puts " => #{line.chop}"
|
78
|
+
end
|
79
|
+
s.close # Close the socket when done
|
56
80
|
end
|
57
|
-
FileUtils.cp(src, dest)
|
58
|
-
puts "teuton-client => " + Rainbow("Init \'#{dest}\' done!").yellow
|
59
|
-
exit 0
|
60
81
|
end
|
61
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teuton-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
@@ -38,7 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.11'
|
41
|
-
description:
|
41
|
+
description: |2
|
42
|
+
TeutonClient send evaluation requests to TeutonServer.
|
43
|
+
|
44
|
+
Teuton Software is an infrastructure test application,
|
45
|
+
that is installed into host called T-NODE. T-NODE user monitorize
|
46
|
+
remote S-NODE users machines using Teuton.
|
47
|
+
|
48
|
+
When a S-NODE user wants to be tested, must wait until T-NODE user
|
49
|
+
launch manually Teuton test units. Or start TeutonServer and attend
|
50
|
+
request automatically.
|
51
|
+
|
52
|
+
Teuton client is used for S-NODE users, to send request to TeutonServer
|
53
|
+
(T-NODE host). This way, S-NODE host is evaluated by the server at any time
|
54
|
+
without T-NODE user intervention.
|
42
55
|
email: teuton.software@protonmail.com
|
43
56
|
executables:
|
44
57
|
- teuton-client
|
@@ -48,7 +61,6 @@ files:
|
|
48
61
|
- bin/teuton-client
|
49
62
|
- lib/teuton-client.rb
|
50
63
|
- lib/teuton-client/application.rb
|
51
|
-
- lib/teuton-client/files/teuton-client.yaml
|
52
64
|
- lib/teuton-client/input_loader.rb
|
53
65
|
homepage: https://github.com/dvarrui/teuton-client
|
54
66
|
licenses:
|