teuton-server 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/installation.md +1 -1
- data/docs/start.md +14 -9
- data/lib/teuton-server/application.rb +1 -1
- data/lib/teuton-server/input_loader.rb +2 -2
- data/lib/teuton-server/service_manager.rb +37 -33
- data/lib/teuton-server.rb +2 -2
- metadata +6 -5
- data/lib/teuton-server/files/teuton-server.yaml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eb8184096b8e41fa039d349c8050072d9cc95db54b7b3bde613064c6e0a176e
|
4
|
+
data.tar.gz: 7d6a326cc2a53846afd5a2ee6786d25d5255efa30ec3f4bfb32a074d6b5fcfa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50ef0a75bbdf2ae4f84dd130322b013ee29a43f5f7dfc2f6e3490605353aa8f30761f139737cae8a8a661d180378d246e58a7d786d81f59000c3d275443ea654
|
7
|
+
data.tar.gz: 7330c7c18bb912e45be34eb70cb8a8423c98a70c2f02a76de99aca84f8e5071b942a4a8e445d1c21d7b1fa3ae4a41e11db4216956ae71c75daa59e3e922047f1
|
data/docs/installation.md
CHANGED
@@ -4,4 +4,4 @@
|
|
4
4
|
> **WARNING**: First, ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed.
|
5
5
|
|
6
6
|
* `gem install teuton-server`, to install TeutonServer.
|
7
|
-
* `teuton-server version`,
|
7
|
+
* `teuton-server version`, display TeutonServer version.
|
data/docs/start.md
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
[<<back](../README.md)
|
2
1
|
|
3
|
-
# Starting
|
2
|
+
# Starting teutonServer
|
4
3
|
|
5
4
|
Resume:
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
* Default config file into current directory
|
7
|
+
* Command: `teuton-server`
|
8
|
+
* Configfile: `teuton-sever.yaml`
|
9
|
+
* Default config file into `foo` directory:
|
10
|
+
* Command: `teuton-server foo`
|
11
|
+
* Configfile: `teuton-server.yaml`
|
12
|
+
* Config file into `foo` directory:
|
13
|
+
* Command: `teuton-server foo/config.yaml`
|
14
|
+
* Configfile: `foo/config.yaml`
|
15
|
+
* Config file into `foo` directory and force server listening IP to X.X.X.X.
|
16
|
+
* Command: `teuton-server foo/config.yaml X.X.X.X`
|
17
|
+
* Configfile: `foo/config.yaml`
|
13
18
|
|
14
19
|
## Default config file
|
15
20
|
|
@@ -57,7 +62,7 @@ teuton-server => Starting...
|
|
57
62
|
teuton-server => service [1] listening on '16001'...
|
58
63
|
```
|
59
64
|
|
60
|
-
##
|
65
|
+
## Force listening IP on fly
|
61
66
|
|
62
67
|
TeutonServer reads params from config file, but it's posible to overwrite listen IP server on fly.
|
63
68
|
|
@@ -3,10 +3,10 @@ require_relative 'application'
|
|
3
3
|
|
4
4
|
# This module reads input configuration
|
5
5
|
module InputLoader
|
6
|
-
# Read
|
6
|
+
# Read configuration
|
7
7
|
# @param args [Array] List of arguments
|
8
8
|
# @return [Hash]
|
9
|
-
def self.
|
9
|
+
def self.read_configuration(args)
|
10
10
|
input = (args.size.zero? ? [Application::CONFIGFILE] : args)
|
11
11
|
param = {}
|
12
12
|
param = read_yaml(input[0])
|
@@ -7,43 +7,47 @@ require_relative 'service'
|
|
7
7
|
# * service 2 listen on port PORT+2, client 2 requests.
|
8
8
|
# * etc.
|
9
9
|
module ServiceManager
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
class << self
|
11
|
+
# Start one service for every client.
|
12
|
+
# @param app_param [Hash] Application configuration params
|
13
|
+
# @return [Exit status] Exit 0 = OK. Exit 1 = ERROR
|
14
|
+
def start_services(app_param)
|
15
|
+
show_starting(app_param)
|
16
|
+
services_param = split_app_param_into_services_param(app_param)
|
17
|
+
services = []
|
18
|
+
begin
|
19
|
+
services_param.each do |param|
|
20
|
+
services << Thread.new{ Service.new.run(param) }
|
21
|
+
end
|
22
|
+
services.each { |service| service.join }
|
23
|
+
rescue SystemExit, Interrupt
|
24
|
+
puts Rainbow("\nteuton-server => Closing...").bright
|
25
|
+
exit 0
|
20
26
|
end
|
21
|
-
services.each { |service| service.join }
|
22
|
-
rescue SystemExit, Interrupt
|
23
|
-
puts Rainbow("\nteuton-server => Closing...").bright
|
24
|
-
exit 0
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
puts Rainbow("teuton-server => Starting...").bright
|
30
|
-
puts " Configfile : #{param[:server][:configfile]}"
|
31
|
-
puts " Listen on : #{param[:server][:ip]}:#{param[:server][:port]}"
|
32
|
-
puts " Test list : #{param[:server][:testunits].join(',')}"
|
33
|
-
puts Rainbow(" (CTRL+C to exit)").bright.yellow
|
34
|
-
end
|
29
|
+
private
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
services_param
|
31
|
+
def show_starting(param)
|
32
|
+
puts Rainbow("teuton-server => Starting...").bright
|
33
|
+
puts " Configfile : #{param[:server][:configfile]}"
|
34
|
+
puts " Listen on : #{param[:server][:ip]}:#{param[:server][:port]}"
|
35
|
+
puts " Test list : #{param[:server][:testunits].join(',')}"
|
36
|
+
puts Rainbow(" (CTRL+C to exit)").bright.yellow
|
37
|
+
end
|
38
|
+
|
39
|
+
def split_app_param_into_services_param(app_param)
|
40
|
+
services_param = []
|
41
|
+
app_param[:clients].each_with_index do |client, index|
|
42
|
+
param = { server: {}, client: {} }
|
43
|
+
param[:server].merge! app_param[:server] if app_param[:server]
|
44
|
+
param[:server][:hostname] = param[:server][:ip]
|
45
|
+
param[:client].merge! client
|
46
|
+
param[:client][:id] = index + 1
|
47
|
+
param[:server][:port] += param[:client][:id]
|
48
|
+
services_param << param
|
49
|
+
end
|
50
|
+
services_param
|
46
51
|
end
|
47
|
-
services_param
|
48
52
|
end
|
49
53
|
end
|
data/lib/teuton-server.rb
CHANGED
@@ -8,7 +8,7 @@ module TeutonServer
|
|
8
8
|
# Start TeutonServer
|
9
9
|
# @param args [Array] List of arguments
|
10
10
|
def self.start(args)
|
11
|
-
param = InputLoader.
|
11
|
+
param = InputLoader.read_configuration(args)
|
12
12
|
ServiceManager.start_services(param)
|
13
13
|
end
|
14
14
|
|
@@ -49,7 +49,7 @@ module TeutonServer
|
|
49
49
|
puts "teuton-server => " + Rainbow("Init \'#{dest}\' done!").yellow
|
50
50
|
exit 0
|
51
51
|
# TODO:
|
52
|
-
# Add testunits list by default
|
52
|
+
# Add testunits list by default
|
53
53
|
# a = Dir.glob(File.join('projects/gnulinux-basic/**','start.rb'))
|
54
54
|
end
|
55
55
|
end
|
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.6
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -38,7 +38,9 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.11'
|
41
|
-
description:
|
41
|
+
description: |2
|
42
|
+
TeutonServer listen requests from TeutonClients.
|
43
|
+
Responds executing Teuton evaluation for that client.
|
42
44
|
email: teuton.software@protonmail.com
|
43
45
|
executables:
|
44
46
|
- teuton-server
|
@@ -56,7 +58,6 @@ files:
|
|
56
58
|
- docs/start.md
|
57
59
|
- lib/teuton-server.rb
|
58
60
|
- lib/teuton-server/application.rb
|
59
|
-
- lib/teuton-server/files/teuton-server.yaml
|
60
61
|
- lib/teuton-server/input_loader.rb
|
61
62
|
- lib/teuton-server/service.rb
|
62
63
|
- lib/teuton-server/service_manager.rb
|
@@ -82,5 +83,5 @@ requirements: []
|
|
82
83
|
rubygems_version: 3.0.3
|
83
84
|
signing_key:
|
84
85
|
specification_version: 4
|
85
|
-
summary: TeutonServer (Teuton Software)
|
86
|
+
summary: TeutonServer (Teuton Software project)
|
86
87
|
test_files: []
|