teuton-server 0.0.3 → 0.0.4

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: 2fd879eee2bf63ef26afa1016d1af68e5d33b3e557254c47be155559ce805198
4
- data.tar.gz: 40066f255f49452b719411ed344f9952199a9599da78bfd6d5be7a21c42cab2a
3
+ metadata.gz: 11b1f8760a26600d169a256acc7cd0be638f09f8245487b09ee13526980ec123
4
+ data.tar.gz: 65128e28e1bb9aa035bcabd18a69c6388cfe3dec673f06a032bfdaac607e2442
5
5
  SHA512:
6
- metadata.gz: a8b17ecfa70d9c2698370baf660ebbae01308ae8240ed71d76c9a32d4a2a048f1aec9161fd0e5018e706a3efbbe20e19e68ce72c5709440735dcacf4ebf0a49b
7
- data.tar.gz: e897f556df76afd1226aad91ae513f8b19dd600da296fe6e0ced96c34769c4d8e0130c5489b10456977ca44ab3475b239a462215aed479cce180a706866e0045
6
+ metadata.gz: 890590971c887ad2a4b6d664cb63b5bd510d8e51eb2cf8743ec9b6d3348c7b94fb3eea9127a38de23caa861e153945c6fabe8488f7a3d62dce4a1d4638fe8da4
7
+ data.tar.gz: 2d66c0aac7b55f47ffd1d446f89d00e79edb6c67e33fb09e5f2263723f174fae41c39af87a914fa4b2046f0de4dab74036b60b125966a9854ca6c9373137185a
data/README.md CHANGED
@@ -9,16 +9,14 @@ But with TeutonServer, T-NODE host listen to evaluation requests from S-NODE hos
9
9
 
10
10
  ## Installation
11
11
 
12
- * Then `gem install teuton-server`, to install TeutonServer.
12
+ * `gem install teuton-server`, to install TeutonServer.
13
13
 
14
14
  > Ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed too.
15
15
 
16
16
  ## Running
17
17
 
18
- 1. `teuton-server init`, create Teuton Server configuration file on T-NODE host. Personalize `teuton-server.yaml` configurations (server IP, testunits names, clients IP, etc).
19
- 1. `teuton-server` runs Teuton Server into T-NODE host.
20
-
21
- > Now we can send requests to TeutonServer from S-NODE hosts, using [Teuton Client](https://github.com/dvarrui/teuton-client).
18
+ 1. `teuton-server init`, create default configuration server file.
19
+ 1. `teuton-server`, runs Teuton Server.
22
20
 
23
21
  ## Documentation
24
22
 
data/docs/configfile.md CHANGED
@@ -25,22 +25,20 @@ Let's see its content:
25
25
 
26
26
  ## Config file params
27
27
 
28
- | Section | Param | Description |
29
- | ------- | --------- | ------------------------- |
30
- | server | ip | Server listening IP |
31
- | | port | Server listen on PORT+1, PORT+2, etc. |
32
- | | testunits | List of Teuton test units names |
33
- | clients | | List of clients: 1, 2, etc. |
34
- | | members | Client name |
35
- | | ip | CLient IP |
36
-
37
- ## Param description
38
-
39
- * **server/port**: Base port for services.
28
+ ### server section
29
+
30
+ Configuration param for Teuton Server.
31
+
32
+ * **ip**: Server listening IP
33
+ * **port**: Base port for services.
40
34
  * `:port: 16000`, client 1 is asigned port 16001, client 2 is assigned 16002 port, and so on.
41
- * **clients**: TeutonServer will attend only the specified clients.
42
- * **clients/members**: Client name or names
43
- * **client/ip**: Server only accepts client request from this IP.
35
+
36
+ ### client section
37
+
38
+ Configuration param for every TeutonClient. TeutonServer will attend only the specified clients.
39
+
40
+ * **members**: Client name or names
41
+ * **ip**: Server only accepts client request from this IP.
44
42
  * `:ip: :allow`, client request are allowed always.
45
43
  * `:ip: :deny`, client request are denied always.
46
44
  * `:ip: 192.168.1.200`, client request are only accepted from 192.168.1.200 IP.
data/docs/installation.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  ## Installation
3
3
 
4
- * WARNING: Install [Teuton Software](https://github.com/teuton-software/teuton)
4
+ > **WARNING**: First, ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed.
5
+
5
6
  * `gem install teuton-server`, to install TeutonServer.
6
7
  * `teuton-server version`, wil display TeutonServer version.
data/lib/teuton-server.rb CHANGED
@@ -5,11 +5,14 @@ require_relative 'teuton-server/input_loader'
5
5
  require_relative 'teuton-server/service_manager'
6
6
 
7
7
  module TeutonServer
8
+ # Start TeutonServer
9
+ # @param args [Array] List of arguments
8
10
  def self.start(args)
9
11
  param = InputLoader.read_input_args(args)
10
12
  ServiceManager.start_services(param)
11
13
  end
12
14
 
15
+ # Show TeutonServer help
13
16
  def self.show_help
14
17
  puts "Usage:"
15
18
  puts " teuton-server [help|version] [PATH/TO/server.yaml [IP]]"
@@ -24,15 +27,20 @@ module TeutonServer
24
27
  exit 0
25
28
  end
26
29
 
30
+ # Show TeutonServer version
27
31
  def self.show_version
28
32
  puts "teuton-server => " + Rainbow("version #{Application::VERSION}").cyan
29
33
  exit 0
30
34
  end
31
35
 
32
- def self.init(arg)
33
- src = File.join(File.dirname(__FILE__), 'teuton-server', 'files',
34
- Application::CONFIGFILE)
35
- dest = File.join(Application::CONFIGFILE)
36
+ # Create default configuration file
37
+ # @param args [Array] List of arguments, where args.first = 'init'
38
+ def self.init(args)
39
+ folder = '.'
40
+ folder = args[1] if args.size > 1
41
+ src = File.join(File.dirname(__FILE__),
42
+ 'teuton-server', 'files', Application::CONFIGFILE)
43
+ dest = File.join(folder, Application::CONFIGFILE)
36
44
  if File.exists? dest
37
45
  puts "teuton-server => " + Rainbow("File \'#{dest}\' exists!").red
38
46
  exit 1
@@ -40,6 +48,8 @@ module TeutonServer
40
48
  FileUtils.cp(src, dest)
41
49
  puts "teuton-server => " + Rainbow("Init \'#{dest}\' done!").yellow
42
50
  exit 0
43
- # TODO: a = Dir.glob(File.join('projects/gnulinux-basic/**','start.rb'))
51
+ # TODO:
52
+ # Add testunits list by default
53
+ # a = Dir.glob(File.join('projects/gnulinux-basic/**','start.rb'))
44
54
  end
45
55
  end
@@ -1,6 +1,7 @@
1
+ # This module groups some global configuration params.
1
2
  module Application
2
3
  NAME = 'teuton-server'
3
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
4
5
  CONFIGFILE = 'teuton-server.yaml'
5
6
  PORT = 16000
6
7
  end
@@ -1,7 +1,11 @@
1
1
  require 'yaml'
2
2
  require_relative 'application'
3
3
 
4
+ # This module reads input configuration
4
5
  module InputLoader
6
+ # Read input configuration
7
+ # @param args [Array] List of arguments
8
+ # @return [Hash]
5
9
  def self.read_input_args(args)
6
10
  input = (args.size.zero? ? [Application::CONFIGFILE] : args)
7
11
  param = {}
@@ -13,6 +17,9 @@ module InputLoader
13
17
  param
14
18
  end
15
19
 
20
+ # Read configuration from YAML file
21
+ # @param filepath [String] Path to YAML file.
22
+ # @return [Hash]
16
23
  def self.read_yaml(filepath)
17
24
  filepath = File.join(filepath,
18
25
  Application::CONFIGFILE) if File.directory? filepath
@@ -1,7 +1,15 @@
1
1
 
2
2
  require_relative 'service'
3
3
 
4
+ # This module start a group of services. One for every client.
5
+ # Every service listen on diferent ports. For example:
6
+ # * service 1 listen on port PORT+1, client 1 requests.
7
+ # * service 2 listen on port PORT+2, client 2 requests.
8
+ # * etc.
4
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
5
13
  def self.start_services(app_param)
6
14
  show_starting(app_param)
7
15
  services_param = split_app_param_into_services_param(app_param)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz