nonnative 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/nonnative.rb +5 -5
- data/lib/nonnative/{system.rb → command.rb} +5 -1
- data/lib/nonnative/pool.rb +15 -13
- data/lib/nonnative/server.rb +4 -0
- data/lib/nonnative/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 515bd5110a2fb8db379637fc056a89daf97eaf02129c373fd69a44ff15f84a99
|
4
|
+
data.tar.gz: 652310aff1902f23ef506320d9fe82238653244ef81d68a01ae3c313fd5bdb84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f66e4a4ac3d018fc69b093807136bccc2d430b97da0165fad8ccbe9439f2cbb81cef26885130a11e46c4128190ba845fd7f39f9945999f32e40d98ce8d65d7fe
|
7
|
+
data.tar.gz: a2bd28a16bd590bac8f33a75543619505f8dccf8c4ee87c7147167b89bb095a5d0647513fbfabbe1118d35e8b0cf8a4ad014026aa9df512cd8c6b5970b9f2de6
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/nonnative.rb
CHANGED
@@ -12,7 +12,7 @@ require 'nonnative/port'
|
|
12
12
|
require 'nonnative/configuration'
|
13
13
|
require 'nonnative/configuration_process'
|
14
14
|
require 'nonnative/configuration_server'
|
15
|
-
require 'nonnative/
|
15
|
+
require 'nonnative/command'
|
16
16
|
require 'nonnative/pool'
|
17
17
|
require 'nonnative/server'
|
18
18
|
require 'nonnative/logger'
|
@@ -40,16 +40,16 @@ module Nonnative
|
|
40
40
|
def start
|
41
41
|
@pool ||= Nonnative::Pool.new(configuration)
|
42
42
|
|
43
|
-
@pool.start do |id, result|
|
44
|
-
logger.error('
|
43
|
+
@pool.start do |name, id, result|
|
44
|
+
logger.error('Started though did respond in time', id: id, name: name) unless result
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def stop
|
49
49
|
return if @pool.nil?
|
50
50
|
|
51
|
-
@pool.stop do |id, result|
|
52
|
-
logger.error('
|
51
|
+
@pool.stop do |name, id, result|
|
52
|
+
logger.error('Stopped though did respond in time', id: id, name: name) unless result
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -1,12 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nonnative
|
4
|
-
class
|
4
|
+
class Command
|
5
5
|
def initialize(process)
|
6
6
|
@process = process
|
7
7
|
@started = false
|
8
8
|
end
|
9
9
|
|
10
|
+
def name
|
11
|
+
process.command
|
12
|
+
end
|
13
|
+
|
10
14
|
def start
|
11
15
|
unless started
|
12
16
|
@pid = spawn(process.command, %i[out err] => [process.file, 'a'])
|
data/lib/nonnative/pool.rb
CHANGED
@@ -22,7 +22,7 @@ module Nonnative
|
|
22
22
|
|
23
23
|
def processes
|
24
24
|
@processes ||= configuration.processes.map do |d|
|
25
|
-
[Nonnative::
|
25
|
+
[Nonnative::Command.new(d), Nonnative::Port.new(d)]
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -32,25 +32,27 @@ module Nonnative
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def process_all(all,
|
36
|
-
|
37
|
-
|
35
|
+
def process_all(all, type_method, port_method, &block)
|
36
|
+
types = []
|
37
|
+
pids = []
|
38
|
+
threads = []
|
38
39
|
|
39
|
-
all.each do |
|
40
|
-
|
41
|
-
|
40
|
+
all.each do |type, port|
|
41
|
+
types << type
|
42
|
+
pids << type.send(type_method)
|
43
|
+
threads << Thread.new { port.send(port_method) }
|
42
44
|
end
|
43
45
|
|
44
|
-
ThreadsWait.all_waits(*
|
46
|
+
ThreadsWait.all_waits(*threads)
|
45
47
|
|
46
|
-
|
48
|
+
ports = threads.map(&:value)
|
47
49
|
|
48
|
-
yield_results(
|
50
|
+
yield_results(types, pids, ports, &block)
|
49
51
|
end
|
50
52
|
|
51
|
-
def yield_results(
|
52
|
-
|
53
|
-
yield id, result
|
53
|
+
def yield_results(all, pids, ports)
|
54
|
+
all.zip(pids, ports).each do |type, id, result|
|
55
|
+
yield type.name, id, result
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
data/lib/nonnative/server.rb
CHANGED
data/lib/nonnative/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonnative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Falkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- bin/setup
|
159
159
|
- lib/nonnative.rb
|
160
160
|
- lib/nonnative/before.rb
|
161
|
+
- lib/nonnative/command.rb
|
161
162
|
- lib/nonnative/configuration.rb
|
162
163
|
- lib/nonnative/configuration_process.rb
|
163
164
|
- lib/nonnative/configuration_server.rb
|
@@ -168,7 +169,6 @@ files:
|
|
168
169
|
- lib/nonnative/port.rb
|
169
170
|
- lib/nonnative/server.rb
|
170
171
|
- lib/nonnative/startup.rb
|
171
|
-
- lib/nonnative/system.rb
|
172
172
|
- lib/nonnative/timeout.rb
|
173
173
|
- lib/nonnative/version.rb
|
174
174
|
- nonnative.gemspec
|