daemon_controller 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/daemon_controller.gemspec +4 -3
- data/lib/daemon_controller.rb +15 -4
- data/lib/daemon_controller/version.rb +2 -2
- data/spec/echo_server.rb +2 -5
- data/spec/run_echo_server +9 -0
- data/spec/test_helper.rb +16 -1
- metadata +19 -39
data/daemon_controller.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "daemon_controller"
|
3
3
|
# Don't forget to update version.rb too.
|
4
|
-
s.version = "1.1.
|
5
|
-
s.date = "
|
4
|
+
s.version = "1.1.1"
|
5
|
+
s.date = "2013-01-20"
|
6
6
|
s.summary = "A library for implementing daemon management capabilities"
|
7
7
|
s.email = "hongli@phusion.nl"
|
8
8
|
s.homepage = "https://github.com/FooBarWidget/daemon_controller"
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"spec/test_helper.rb",
|
20
20
|
"spec/daemon_controller_spec.rb",
|
21
21
|
"spec/echo_server.rb",
|
22
|
-
"spec/unresponsive_daemon.rb"
|
22
|
+
"spec/unresponsive_daemon.rb",
|
23
|
+
"spec/run_echo_server"
|
23
24
|
]
|
24
25
|
end
|
data/lib/daemon_controller.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# daemon_controller, library for robust daemon management
|
2
|
-
# Copyright (c) 2010
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -777,6 +777,12 @@ private
|
|
777
777
|
begin
|
778
778
|
socket.connect_nonblock(sockaddr)
|
779
779
|
rescue Errno::EISCONN
|
780
|
+
rescue Errno::EINVAL
|
781
|
+
if RUBY_PLATFORM =~ /freebsd/i
|
782
|
+
raise Errno::ECONNREFUSED
|
783
|
+
else
|
784
|
+
raise
|
785
|
+
end
|
780
786
|
end
|
781
787
|
else
|
782
788
|
raise Errno::ECONNREFUSED
|
@@ -792,10 +798,15 @@ private
|
|
792
798
|
end
|
793
799
|
|
794
800
|
def ruby_interpreter
|
801
|
+
if defined?(RbConfig)
|
802
|
+
rb_config = RbConfig::CONFIG
|
803
|
+
else
|
804
|
+
rb_config = Config::CONFIG
|
805
|
+
end
|
795
806
|
File.join(
|
796
|
-
|
797
|
-
|
798
|
-
) +
|
807
|
+
rb_config['bindir'],
|
808
|
+
rb_config['RUBY_INSTALL_NAME']
|
809
|
+
) + rb_config['EXEEXT']
|
799
810
|
end
|
800
811
|
|
801
812
|
def safe_fork(double_fork)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# daemon_controller, library for robust daemon management
|
2
|
-
# Copyright (c) 2010
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -22,6 +22,6 @@
|
|
22
22
|
class DaemonController
|
23
23
|
MAJOR = 1
|
24
24
|
MINOR = 1
|
25
|
-
TINY =
|
25
|
+
TINY = 1
|
26
26
|
VERSION_STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
|
27
27
|
end # class DaemonController
|
data/spec/echo_server.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
# A simple echo server, used by the unit test.
|
3
|
-
# The hashbang is explicitly set to /usr/bin/ruby because we need
|
4
|
-
# a Ruby implementation that starts fast and supports forking. The
|
5
|
-
# Ruby in $PATH may be JRuby which is neither.
|
6
3
|
require 'socket'
|
7
4
|
require 'optparse'
|
8
5
|
|
@@ -89,7 +86,7 @@ def main(options)
|
|
89
86
|
if options[:pid_file]
|
90
87
|
sleep(options[:wait1])
|
91
88
|
File.open(options[:pid_file], 'w') do |f|
|
92
|
-
f.
|
89
|
+
f.puts(Process.pid)
|
93
90
|
end
|
94
91
|
at_exit do
|
95
92
|
File.unlink(options[:pid_file]) rescue nil
|
data/spec/test_helper.rb
CHANGED
@@ -2,9 +2,24 @@ root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
|
2
2
|
$LOAD_PATH.unshift(File.join(root, "lib"))
|
3
3
|
Dir.chdir(root)
|
4
4
|
|
5
|
+
if !ENV['MRI_RUBY']
|
6
|
+
if RUBY_PLATFORM =~ /java/
|
7
|
+
# We need a Ruby implementation that starts fast and supports forking.
|
8
|
+
# JRuby is neither.
|
9
|
+
abort "In order to run these tests in JRuby, you must set " +
|
10
|
+
"the environment variable $MRI_RUBY to an MRI Ruby interpeter."
|
11
|
+
else
|
12
|
+
require 'rbconfig'
|
13
|
+
rb_config = defined?(RbConfig) ? RbConfig::CONFIG : Config::CONFIG
|
14
|
+
ENV['MRI_RUBY'] = rb_config['bindir'] + '/' + rb_config['RUBY_INSTALL_NAME'] +
|
15
|
+
rb_config['EXEEXT']
|
16
|
+
puts ENV['MRI_RUBY']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
5
20
|
module TestHelper
|
6
21
|
def new_controller(options = {})
|
7
|
-
@start_command = './spec/
|
22
|
+
@start_command = './spec/run_echo_server -l spec/echo_server.log -P spec/echo_server.pid'
|
8
23
|
if options[:wait1]
|
9
24
|
@start_command << " --wait1 #{options[:wait1]}"
|
10
25
|
end
|
metadata
CHANGED
@@ -1,32 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemon_controller
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Hongli Lai
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-10-27 00:00:00 Z
|
12
|
+
date: 2013-01-20 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: A library for robust daemon management.
|
22
15
|
email: hongli@phusion.nl
|
23
16
|
executables: []
|
24
|
-
|
25
17
|
extensions: []
|
26
|
-
|
27
18
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
19
|
+
files:
|
30
20
|
- README.markdown
|
31
21
|
- LICENSE.txt
|
32
22
|
- daemon_controller.gemspec
|
@@ -38,39 +28,29 @@ files:
|
|
38
28
|
- spec/daemon_controller_spec.rb
|
39
29
|
- spec/echo_server.rb
|
40
30
|
- spec/unresponsive_daemon.rb
|
31
|
+
- spec/run_echo_server
|
41
32
|
homepage: https://github.com/FooBarWidget/daemon_controller
|
42
33
|
licenses: []
|
43
|
-
|
44
34
|
post_install_message:
|
45
35
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
36
|
+
require_paths:
|
48
37
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
45
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
67
50
|
requirements: []
|
68
|
-
|
69
51
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.8.
|
52
|
+
rubygems_version: 1.8.24
|
71
53
|
signing_key:
|
72
54
|
specification_version: 3
|
73
55
|
summary: A library for implementing daemon management capabilities
|
74
56
|
test_files: []
|
75
|
-
|
76
|
-
has_rdoc: true
|