spurious-server 0.5.1 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14fd78da1669839cfe6209fc0601205e1db24ddf
4
- data.tar.gz: 5f9d7051975ef4464abd6a7ca7dd6e19ee4ee0ed
3
+ metadata.gz: 0240d9ed86b29f8978894e14c9cd2efb4f91fbd6
4
+ data.tar.gz: 13373c56366b814de4cfc6f805e5936864cd82b7
5
5
  SHA512:
6
- metadata.gz: a7748c40353a0919a53e7b2d10b5968aa31332aab102be7eae4daf58c4bd3c7a9deb4e398cf85ea4bbefaff1943fb57e418717cca15790032a5b8685fa8140a2
7
- data.tar.gz: 659a1f3e3720732b9d22622d62a5725c4793a82bb8b4f9b659cb1b606de53c2106c3d9bae9e7aa318400aeee590f3771d5f4c05d43f0b5d01c8cafd94a7293ac
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
- Daemons.run_proc('Spurious_Server', :dir => '/tmp', :log_output => true) do
16
- EventMachine.synchrony Spurious::Server.handle(options)
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
@@ -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(
@@ -19,6 +19,7 @@ module Spurious
19
19
  Excon.defaults[:write_timeout] = write
20
20
  Excon.defaults[:read_timeout] = read
21
21
  Excon.defaults[:connect_timeout] = connect
22
+ Excon.defaults[:ssl_verify_peer] = false
22
23
  end
23
24
 
24
25
  def execute!
@@ -11,7 +11,7 @@ module Spurious
11
11
 
12
12
  def initialize(connection, config, docker_host)
13
13
  super(connection, config)
14
- connection_timeouts 2, 600, 600
14
+ connection_timeouts 2, 3600, 3600
15
15
  @docker_host = docker_host
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
1
  module Spurious
2
2
  module Server
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.2"
4
4
  end
5
5
  end
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.1
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-01-30 00:00:00.000000000 Z
11
+ date: 2015-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler