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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15fe4d2fa0cccafe29a60ee452af6e7db3b58a61fe4799eba47edb2cd9ec6dd1
4
- data.tar.gz: b1a98d7814bb3318aa067a3608d2ca4e9736bf2e097549458471bdd6db4246f6
3
+ metadata.gz: 3eb8184096b8e41fa039d349c8050072d9cc95db54b7b3bde613064c6e0a176e
4
+ data.tar.gz: 7d6a326cc2a53846afd5a2ee6786d25d5255efa30ec3f4bfb32a074d6b5fcfa2
5
5
  SHA512:
6
- metadata.gz: a6550725b816d13a70ccde29633ec40ff0014117d516c821cb5c913f1cfcb4694e67f57e4164e78b25e6fe20ae31565048eef8904d0fada4e6400986ba220d52
7
- data.tar.gz: 867ce95370866a43f9644c47fff485166141f191aad4754a2fce82473f75b2e606cd648fae8866f6edb630f38310a731b0cefd3f53add939722b086f27cb1f19
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`, wil display TeutonServer 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 TeutonServer
2
+ # Starting teutonServer
4
3
 
5
4
  Resume:
6
5
 
7
- | Command | Configfile | Location |
8
- | ------------- | ----------------- | ----------------------------- |
9
- | teuton-server | teuton-sever.yaml | Config into current directory |
10
- | teuton-server foo | teuton-server.yaml | Config into foo directory |
11
- | teuton-server foo/config.yaml | config.yaml | Config into foo directory |
12
- | teuton-server foo/config.yaml X.X.X.X | config.yaml | Config into foo directory and server liste IP=X.X.X.X |
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
- ## Change listen IP on fly
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
 
@@ -1,7 +1,7 @@
1
1
  # This module groups some global configuration params.
2
2
  module Application
3
3
  NAME = 'teuton-server'
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  CONFIGFILE = 'teuton-server.yaml'
6
6
  PORT = 16000
7
7
  end
@@ -3,10 +3,10 @@ require_relative 'application'
3
3
 
4
4
  # This module reads input configuration
5
5
  module InputLoader
6
- # Read input configuration
6
+ # Read configuration
7
7
  # @param args [Array] List of arguments
8
8
  # @return [Hash]
9
- def self.read_input_args(args)
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
- # Start one service for every client.
11
- # @param app_param [Hash] Application configuration params
12
- # @return [Exit status] Exit 0 = OK. Exit 1 = ERROR
13
- def self.start_services(app_param)
14
- show_starting(app_param)
15
- services_param = split_app_param_into_services_param(app_param)
16
- services = []
17
- begin
18
- services_param.each do |param|
19
- services << Thread.new{ Service.new.run(param) }
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
- def self.show_starting(param)
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
- def self.split_app_param_into_services_param(app_param)
37
- services_param = []
38
- app_param[:clients].each_with_index do |client, index|
39
- param = { server: {}, client: {} }
40
- param[:server].merge! app_param[:server] if app_param[:server]
41
- param[:server][:hostname] = param[:server][:ip]
42
- param[:client].merge! client
43
- param[:client][:id] = index + 1
44
- param[:server][:port] += param[:client][:id]
45
- services_param << 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.read_input_args(args)
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.5
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-09 00:00:00.000000000 Z
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: TeutonServer listens and responds TeutonClients request
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: []
@@ -1,9 +0,0 @@
1
- ---
2
- :server:
3
- :ip: 127.0.0.1
4
- :port: 16000
5
- :testunits:
6
- - testname01
7
- :clients:
8
- - :members: client01
9
- :ip: 127.0.0.1