spurious-server 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/spurious-server +4 -2
- data/lib/spurious/server.rb +17 -0
- data/lib/spurious/server/state/base.rb +1 -0
- data/lib/spurious/server/state/init.rb +1 -1
- data/lib/spurious/server/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0240d9ed86b29f8978894e14c9cd2efb4f91fbd6
|
4
|
+
data.tar.gz: 13373c56366b814de4cfc6f805e5936864cd82b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba7a4afa4f0d8be5424cd200153c3ff690fe42a9694b21f96be4dfe3fa5e50b57b0f2fd0deb3f6b21accfc20966e091fb15ac9aaba7708d89431be80df80ee0
|
7
|
+
data.tar.gz: d4b96b1b61134451575c4d57013fb075d99f37ad0b7cf23d8d7973ce8e1667d87a04ce201ca61728e63c5fd652161d09208dff51c0994497f42f7b8066e698ad
|
data/bin/spurious-server
CHANGED
@@ -12,6 +12,8 @@ require 'spurious/server/options'
|
|
12
12
|
options = Spurious::Server::Options.new(ENV)
|
13
13
|
ENV['DOCKER_HOST'] = options.ssl_docker_host
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
if Spurious::Server.docker_daemon_available? ARGV[0]
|
16
|
+
Daemons.run_proc('.spurious-server', :dir => '~/') do
|
17
|
+
EventMachine.synchrony Spurious::Server.handle(options)
|
18
|
+
end
|
17
19
|
end
|
data/lib/spurious/server.rb
CHANGED
@@ -5,6 +5,23 @@ require "spurious/server/app"
|
|
5
5
|
module Spurious
|
6
6
|
module Server
|
7
7
|
|
8
|
+
TIMEOUT = 5
|
9
|
+
SHELL_RED = "\e[31m"
|
10
|
+
SHELL_GREEN = "\e[32m"
|
11
|
+
SHELL_CLEAR = "\e[0m"
|
12
|
+
|
13
|
+
def self.docker_daemon_available?(daemon_action)
|
14
|
+
if daemon_action == 'start'
|
15
|
+
puts "#{SHELL_GREEN} Checking docker daemon is available...#{SHELL_CLEAR}"
|
16
|
+
Excon.defaults[:connect_timeout] = Excon.defaults[:read_timeout] = TIMEOUT
|
17
|
+
!Docker.info.nil?
|
18
|
+
end
|
19
|
+
true
|
20
|
+
rescue Excon::Errors::SocketError, Excon::Errors::Timeout, Docker::Error::TimeoutError => e
|
21
|
+
puts "#{SHELL_RED} Connecting to the docker daemon (#{ENV["DOCKER_HOST"]}) failed... Check that it's running"
|
22
|
+
exit -1
|
23
|
+
end
|
24
|
+
|
8
25
|
def self.handle(options)
|
9
26
|
Proc.new do
|
10
27
|
EventMachine.start_server(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spurious-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|