test_server_rb 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 1eb14ffcfc77aa7cd5856a818ce4ed1ecda02394
4
- data.tar.gz: f8c26c02d7856423d23701ea87a5fde681f8a970
3
+ metadata.gz: 161eb86462ccdd0f44087e996ed93cce19e298b0
4
+ data.tar.gz: eeff69b5debd38143aed37cd976e37cab049d00a
5
5
  SHA512:
6
- metadata.gz: 498695ac9e2ae50afae19bb83977ed5afaab3a840d49d4f45e582367c8b1e67de3caac2de69d80ece7f340aec83a808744d417eafb954c0c020a8489c71b4738
7
- data.tar.gz: f707f1417d597368339fdfd2d8134fc52b55b680c2b5baa1b2be6d860a99252aace9683015f40f612319c0a9f6f5ef8e9c3dc3664d888426d581c1bf5525335f
6
+ metadata.gz: af5a2e95acd132c7cfedbf09ae030da9002b01022acf9fd3af131ce36764be30d6b1b551023628883d64efebbe623cfcb3b2a23dfe01086329a749c5076a641c
7
+ data.tar.gz: 4c83df1ae0757dd5ae8e7763297ec7be7170ebcabba20d59f9f09eba224eedfafbfdf51388e43c7fe9b7f8f6240c69ed79a223ee082ad8c2210ab20779d3622f
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $: << 'test'
4
+ require 'bundler/setup'
5
+ require 'socket'
6
+ require 'terminal-notifier' if ENV['NOTIFY']
7
+
8
+ module TestServer
9
+ class << self
10
+ def client
11
+ @client ||= TCPSocket.new(ENV['HOST'], ENV['PORT'])
12
+ end
13
+
14
+ def server
15
+ @server ||= TCPServer.new(ENV['HOST'], ENV['PORT'])
16
+ end
17
+
18
+ def test(files)
19
+ client.sendmsg files.join(' ')
20
+ end
21
+
22
+ def start!
23
+ puts "Initializing TestServer with pid #{$$}..."
24
+ require 'test_helper'
25
+ puts "Ready!"
26
+ loop do
27
+ conn = server.accept
28
+ files, _ = conn.recvmsg
29
+ pid = fork do
30
+ puts "> Testing files: #{files}"
31
+ if files == ":all".freeze
32
+ all_glob = ENV['ALL_GLOB'] || 'test/unit/*_test.rb'
33
+ Dir.glob(all_glob).each { |f| load f }
34
+ else
35
+ files.split(' ').each { |f| load f }
36
+ end
37
+ end
38
+ _, status = Process.wait2(pid)
39
+ if ENV['NOTIFY']
40
+ msg = (status.exitstatus == 0) ? "Tests passed :)" : "Warning! Tests failed :("
41
+ TerminalNotifier.notify(msg)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ queue = ARGV
49
+ until queue.empty?
50
+ case queue.shift
51
+ when "--serve"
52
+ TestServer.start!
53
+ when "--test"
54
+ TestServer.test(queue)
55
+ queue = []
56
+ end
57
+ end
58
+
@@ -1,3 +1,3 @@
1
1
  module TestServer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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: 0.1.0
4
+ version: 0.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: 2018-11-26 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -43,6 +43,7 @@ email:
43
43
  - joshuabodah@gmail.com
44
44
  executables:
45
45
  - test_server
46
+ - test_server_remote
46
47
  extensions: []
47
48
  extra_rdoc_files: []
48
49
  files:
@@ -53,6 +54,7 @@ files:
53
54
  - bin/console
54
55
  - bin/setup
55
56
  - exe/test_server
57
+ - exe/test_server_remote
56
58
  - lib/test_server.rb
57
59
  - lib/test_server/version.rb
58
60
  - test_server.gemspec