teuton-server 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/teuton-server +1 -1
- data/lib/teuton-server/application.rb +5 -4
- data/lib/teuton-server/service.rb +11 -2
- data/lib/teuton-server.rb +26 -7
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec933cb05436596fafa3db82ed125be0fb80201098cac2840798a794f8af4736
|
4
|
+
data.tar.gz: e95c6c46ccb016feacbf42f2083d2106384a6a9f7f01735904365ecf0d7b4d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7499a9387e09c676eea03818686693c27bdd19aa709334d3de919990420ecf64af96e916979e4350043fc1b3f47157942f4ae4fae8aece6a72e50f065bca2c74
|
7
|
+
data.tar.gz: c1cfffaf08176150a1cab549e725746e19209aed1a527d60c7643dcd79f8890712a8bfac921b3729eb3d31c2c388f5fc9c2e672cd9f1f2a490b803a2c3c947ab
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ But with TeutonServer, T-NODE host listen to evaluation requests from S-NODE hos
|
|
11
11
|
|
12
12
|
* `gem install teuton-server`, to install TeutonServer.
|
13
13
|
|
14
|
-
> Ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed too.
|
14
|
+
> Ensure [Teuton Software (version => 2.1)](https://github.com/teuton-software/teuton) is installed too.
|
15
15
|
|
16
16
|
## Running
|
17
17
|
|
data/bin/teuton-server
CHANGED
@@ -9,5 +9,5 @@ require 'teuton-server'
|
|
9
9
|
# * start => Start Teuton Server
|
10
10
|
TeutonServer.show_help if ARGV.first == 'help'
|
11
11
|
TeutonServer.show_version if ARGV.first == 'version'
|
12
|
-
TeutonServer.init(ARGV) if ARGV.first == 'init'
|
12
|
+
TeutonServer.init(ARGV.slice(1,ARGV.size)) if ARGV.first == 'init'
|
13
13
|
TeutonServer.start(ARGV)
|
@@ -1,7 +1,8 @@
|
|
1
|
+
##
|
1
2
|
# This module groups some global configuration params.
|
2
3
|
module Application
|
3
|
-
NAME = 'teuton-server'
|
4
|
-
VERSION = '0.0.
|
5
|
-
CONFIGFILE = 'teuton-server.yaml'
|
6
|
-
PORT = 16000
|
4
|
+
NAME = 'teuton-server' # Application name
|
5
|
+
VERSION = '0.0.8' # Application version
|
6
|
+
CONFIGFILE = 'teuton-server.yaml' # Default config file name
|
7
|
+
PORT = 16000 # Default base port
|
7
8
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'socket'
|
2
2
|
|
3
|
+
##
|
4
|
+
# This class wake up service to respond request from 1 client.
|
3
5
|
class Service
|
6
|
+
##
|
7
|
+
# Run 1 service to respond request from 1 client.
|
8
|
+
# @param param [Hash] Service params
|
4
9
|
def run(param)
|
5
10
|
service = TCPServer.open(param[:server][:port])
|
6
11
|
accept_clients service, param
|
@@ -25,7 +30,10 @@ class Service
|
|
25
30
|
end
|
26
31
|
|
27
32
|
def authorized_request?(client, param)
|
28
|
-
|
33
|
+
if param[:client][:ip] == :allow
|
34
|
+
param[:client][:ip] = client.peeraddr[2]
|
35
|
+
return true
|
36
|
+
end
|
29
37
|
return false if param[:client][:ip] == :deny
|
30
38
|
return param[:client][:ip] == client.peeraddr[2]
|
31
39
|
end
|
@@ -58,6 +66,7 @@ class Service
|
|
58
66
|
ok = system(command)
|
59
67
|
action = {}
|
60
68
|
action[:timestamp] = Time.now
|
69
|
+
action[:testname] = testname
|
61
70
|
action[:cmd] = command
|
62
71
|
action[:grade] = Rainbow('FAIL!').red
|
63
72
|
action[:grade] = get_grade_from_report(param, testindex) if ok
|
@@ -92,7 +101,7 @@ class Service
|
|
92
101
|
puts output
|
93
102
|
client.puts("Connection : #{src} -> #{dest} ")
|
94
103
|
client.puts("Timestamp : #{action[:timestamp]}")
|
95
|
-
client.puts("
|
104
|
+
client.puts("Test Name : #{action[:testname]}")
|
96
105
|
client.puts("Grade : #{action[:grade]}")
|
97
106
|
client.close
|
98
107
|
end
|
data/lib/teuton-server.rb
CHANGED
@@ -4,8 +4,18 @@ require_relative 'teuton-server/application'
|
|
4
4
|
require_relative 'teuton-server/input_loader'
|
5
5
|
require_relative 'teuton-server/service_manager'
|
6
6
|
|
7
|
+
##
|
8
|
+
# TeutonServer has these main actions:
|
9
|
+
# * help => show_help
|
10
|
+
# * version => show_version
|
11
|
+
# * init => init or create server config file
|
12
|
+
# * start => Start Teuton Server
|
7
13
|
module TeutonServer
|
8
|
-
|
14
|
+
##
|
15
|
+
# Start TeutonServer arguments:
|
16
|
+
# * No arguments => start server with default config file (teuton-server.yaml).
|
17
|
+
# * Directory => start server with default config file (DIR/teuton-server.yaml).
|
18
|
+
# * YAML file => start server with config file (file.yaml).
|
9
19
|
# @param args [Array] List of arguments
|
10
20
|
def self.start(args)
|
11
21
|
param = InputLoader.read_configuration(args)
|
@@ -22,8 +32,10 @@ module TeutonServer
|
|
22
32
|
puts " init , Create server.yaml config file"
|
23
33
|
puts " CONFIGFILE, YAML server configuration file"
|
24
34
|
puts "Example:"
|
25
|
-
puts "
|
26
|
-
|
35
|
+
puts " teuton-server server.yaml 192.168.1.16 " +
|
36
|
+
"# Start TeutonServer using 192.168.1.16 IP:"
|
37
|
+
puts " teuton-server init foo/config.yaml " +
|
38
|
+
"# Create config file"
|
27
39
|
exit 0
|
28
40
|
end
|
29
41
|
|
@@ -33,14 +45,21 @@ module TeutonServer
|
|
33
45
|
exit 0
|
34
46
|
end
|
35
47
|
|
36
|
-
# Create default configuration file
|
48
|
+
# Create default configuration file. Arguments:
|
49
|
+
# * "" => Create default config file (teuton-server.yaml)
|
50
|
+
# * "DIR" => Create DIR/teuton-server.yaml config file.
|
51
|
+
# * "FILE.yaml" => Create FILE.yaml config file.
|
37
52
|
# @param args [Array] List of arguments, where args.first = 'init'
|
38
53
|
def self.init(args)
|
39
|
-
folder = '.'
|
40
|
-
folder = args[1] if args.size > 1
|
41
54
|
src = File.join(File.dirname(__FILE__),
|
42
55
|
'teuton-server', 'files', Application::CONFIGFILE)
|
43
|
-
dest = File.join(
|
56
|
+
dest = File.join(Application::CONFIGFILE)
|
57
|
+
|
58
|
+
if args.size > 0
|
59
|
+
file = args.first
|
60
|
+
dest = File.join(file) if File.extname(file) == '.yaml'
|
61
|
+
dest = File.join(file, Application::CONFIGFILE) if File.directory? file
|
62
|
+
end
|
44
63
|
if File.exists? dest
|
45
64
|
puts "teuton-server => " + Rainbow("File \'#{dest}\' exists!").red
|
46
65
|
exit 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teuton-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
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
|
+
date: 2019-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: teuton
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.1.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: minitest
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,9 +61,9 @@ executables:
|
|
47
61
|
extensions: []
|
48
62
|
extra_rdoc_files:
|
49
63
|
- README.md
|
50
|
-
- docs/configfile.md
|
51
|
-
- docs/installation.md
|
52
64
|
- docs/start.md
|
65
|
+
- docs/installation.md
|
66
|
+
- docs/configfile.md
|
53
67
|
files:
|
54
68
|
- README.md
|
55
69
|
- bin/teuton-server
|
@@ -80,7 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
94
|
- !ruby/object:Gem::Version
|
81
95
|
version: '0'
|
82
96
|
requirements: []
|
83
|
-
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.7.6.2
|
84
99
|
signing_key:
|
85
100
|
specification_version: 4
|
86
101
|
summary: TeutonServer (Teuton Software project)
|