test_server_rb 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -0
- data/exe/test_server +4 -0
- data/exe/test_server_remote +5 -0
- data/lib/test_server.rb +20 -3
- data/lib/test_server/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 12f06fcd7830907ad21377be3d8ce55e90880841
|
4
|
+
data.tar.gz: e3eb13085e67ef0d9f3a70fc0f1b33eb32089bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c075d40fb6873d2726b98c9261382b224b3454c08a3486dd270b658cd16d88fb4967360f63695bd07541bfe7edc087a66bb6d2f456fd0dee5b4b99081eb2300f
|
7
|
+
data.tar.gz: '0874d56b1fd247b3a36817cb106742f9a36a146a22f67c3da95932e96c12f7a49a296c96bf0dd693a02848f82715a1498494f126aafaf9b6306042c64a4c8f1f'
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
dead simple fork based test server
|
4
4
|
|
5
|
+
## Description
|
6
|
+
|
7
|
+
`test_server` is a generic tool that lets you quickly build an ad-hoc Ruby workflow efficiently. It provides you with a server/client model where the client instructs the server on which files to load. The server will fork off a new child process which load those files and then the server will listen for more instructions. The most common use case for this is for testing, but it also could be used for compiling or other tasks
|
8
|
+
|
5
9
|
## Usage
|
6
10
|
|
7
11
|
```
|
data/exe/test_server
CHANGED
@@ -46,6 +46,10 @@ OptionParser.new do |opts|
|
|
46
46
|
opts.on("--after-fork CODE", "Ruby code to run immediately after forking (default: \"\")") do |code|
|
47
47
|
options[:after_fork] = code
|
48
48
|
end
|
49
|
+
|
50
|
+
opts.on("--forward-exit-code", "Calling process will exit with the fork child's exit code") do |forward_exit_code|
|
51
|
+
options[:forward_exit_code] = forward_exit_code
|
52
|
+
end
|
49
53
|
end.parse!
|
50
54
|
|
51
55
|
options[:files] = ARGV
|
data/exe/test_server_remote
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
+
$: << "lib"
|
3
4
|
$: << 'test'
|
4
5
|
require 'test_server'
|
5
6
|
require 'optparse'
|
@@ -51,6 +52,10 @@ OptionParser.new do |opts|
|
|
51
52
|
opts.on("--after-fork CODE", "Ruby code to run immediately after forking (default: \"\")") do |code|
|
52
53
|
options[:after_fork] = code
|
53
54
|
end
|
55
|
+
|
56
|
+
opts.on("--forward-exit-code", "Calling process will exit with the fork child's exit code") do |forward_exit_code|
|
57
|
+
options[:forward_exit_code] = forward_exit_code
|
58
|
+
end
|
54
59
|
end.parse!
|
55
60
|
|
56
61
|
options[:files] = ARGV
|
data/lib/test_server.rb
CHANGED
@@ -15,6 +15,17 @@ module TestServer
|
|
15
15
|
def test(options)
|
16
16
|
with_client(options) do |client|
|
17
17
|
client.sendmsg options[:files].join(' ')
|
18
|
+
|
19
|
+
if options[:forward_exit_code]
|
20
|
+
exit_code, _ = client.recvmsg
|
21
|
+
exit_code = exit_code.to_i
|
22
|
+
if exit_code == 0
|
23
|
+
notify("Tests passed :)") if options[:notify_on_pass]
|
24
|
+
else
|
25
|
+
notify("Warning! Tests failed :(") if options[:notify_on_fail]
|
26
|
+
end
|
27
|
+
exit(exit_code)
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
|
@@ -37,10 +48,16 @@ module TestServer
|
|
37
48
|
end
|
38
49
|
end
|
39
50
|
_, status = Process.wait2(pid)
|
40
|
-
|
41
|
-
|
51
|
+
exit_code = status.exitstatus
|
52
|
+
|
53
|
+
if options[:forward_exit_code]
|
54
|
+
conn.sendmsg exit_code.to_s
|
42
55
|
else
|
43
|
-
|
56
|
+
if exit_code == 0
|
57
|
+
notify("Tests passed :)") if options[:notify_on_pass]
|
58
|
+
else
|
59
|
+
notify("Warning! Tests failed :(") if options[:notify_on_fail]
|
60
|
+
end
|
44
61
|
end
|
45
62
|
end
|
46
63
|
end
|
data/lib/test_server/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_server_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Bodah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.5.2.3
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: dead simple fork based test server
|