daemonizer 0.4.18 → 0.5.0.beta.1
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.
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/Rakefile +9 -29
- data/daemonizer.gemspec +20 -69
- data/lib/daemonizer.rb +10 -4
- data/lib/daemonizer/cli.rb +14 -1
- data/lib/daemonizer/config.rb +2 -2
- data/lib/daemonizer/dsl.rb +16 -4
- data/lib/daemonizer/engine.rb +41 -36
- data/lib/daemonizer/option.rb +11 -5
- data/lib/daemonizer/process_manager.rb +7 -3
- data/lib/daemonizer/version.rb +3 -0
- data/lib/daemonizer/worker.rb +16 -2
- data/lib/daemonizer/worker_pool.rb +10 -4
- data/spec/cli/debugging_spec.rb +45 -0
- data/spec/cli/not_started_spec.rb +127 -0
- data/spec/cli/started_spec.rb +121 -0
- data/spec/common/forking_spec.rb +35 -0
- data/spec/settings/callbacks_spec.rb +103 -0
- data/spec/settings/options_spec.rb +146 -0
- data/spec/settings/pools_spec.rb +43 -0
- data/spec/spec_helper.rb +56 -8
- data/spec/support/daemonfile_factory.rb +33 -0
- data/spec/support/helpers.rb +70 -0
- data/spec/support/path.rb +18 -0
- data/spec/support/processes.rb +23 -0
- data/spec/support/ruby_ext.rb +19 -0
- metadata +107 -50
- data/VERSION +0 -1
- data/spec/spec.opts +0 -1
- data/spec/test_spec.rb +0 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Spec
|
|
2
|
+
module Processes
|
|
3
|
+
def children_count(parent_pid)
|
|
4
|
+
children_pids(parent_pid).count
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def children_pids(parent_pid)
|
|
8
|
+
`ps -lx`.lines.to_a[1..-1].map do |l|
|
|
9
|
+
_, pid, ppid, = l.lstrip.split(/\s{1,}/)
|
|
10
|
+
ppid.to_i == parent_pid.to_i ? pid : nil
|
|
11
|
+
end.compact.uniq
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def pid(pid_file)
|
|
15
|
+
File.read(pid_file).chomp
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
extend self
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class IO
|
|
2
|
+
def read_available_bytes(chunk_size = 1024, select_timeout = 5)
|
|
3
|
+
buffer = []
|
|
4
|
+
|
|
5
|
+
return "" if closed? || eof?
|
|
6
|
+
# IO.select cannot be used here due to the fact that it
|
|
7
|
+
# just does not work on windows
|
|
8
|
+
while true
|
|
9
|
+
begin
|
|
10
|
+
buffer << self.readpartial(chunk_size)
|
|
11
|
+
sleep 0.1
|
|
12
|
+
rescue(EOFError)
|
|
13
|
+
break
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
return buffer.join
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: daemonizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 62196465
|
|
5
|
+
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
8
|
+
- 5
|
|
9
|
+
- 0
|
|
10
|
+
- beta
|
|
11
|
+
- 1
|
|
12
|
+
version: 0.5.0.beta.1
|
|
11
13
|
platform: ruby
|
|
12
14
|
authors:
|
|
13
15
|
- Gleb Pomykalov
|
|
@@ -15,29 +17,42 @@ autorequire:
|
|
|
15
17
|
bindir: bin
|
|
16
18
|
cert_chain: []
|
|
17
19
|
|
|
18
|
-
date: 2011-
|
|
19
|
-
default_executable: daemonizer
|
|
20
|
+
date: 2011-11-09 00:00:00 Z
|
|
20
21
|
dependencies:
|
|
21
22
|
- !ruby/object:Gem::Dependency
|
|
22
|
-
|
|
23
|
-
prerelease: false
|
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
25
24
|
none: false
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
28
|
+
hash: 11
|
|
30
29
|
segments:
|
|
30
|
+
- 2
|
|
31
|
+
- 1
|
|
31
32
|
- 0
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
version: 2.1.0
|
|
34
|
+
requirement: *id001
|
|
35
|
+
prerelease: false
|
|
36
|
+
name: rspec
|
|
37
|
+
type: :development
|
|
37
38
|
- !ruby/object:Gem::Dependency
|
|
38
|
-
|
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 41
|
|
45
|
+
segments:
|
|
46
|
+
- 0
|
|
47
|
+
- 9
|
|
48
|
+
- 9
|
|
49
|
+
version: 0.9.9
|
|
50
|
+
requirement: *id002
|
|
39
51
|
prerelease: false
|
|
40
|
-
|
|
52
|
+
name: mocha
|
|
53
|
+
type: :development
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
41
56
|
none: false
|
|
42
57
|
requirements:
|
|
43
58
|
- - ">="
|
|
@@ -46,53 +61,72 @@ dependencies:
|
|
|
46
61
|
segments:
|
|
47
62
|
- 0
|
|
48
63
|
version: "0"
|
|
49
|
-
|
|
50
|
-
version_requirements: *id002
|
|
51
|
-
- !ruby/object:Gem::Dependency
|
|
52
|
-
name: rspec
|
|
64
|
+
requirement: *id003
|
|
53
65
|
prerelease: false
|
|
54
|
-
|
|
66
|
+
name: yard
|
|
67
|
+
type: :development
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
55
70
|
none: false
|
|
56
71
|
requirements:
|
|
57
72
|
- - ">="
|
|
58
73
|
- !ruby/object:Gem::Version
|
|
59
|
-
hash:
|
|
74
|
+
hash: 3
|
|
60
75
|
segments:
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
- 0
|
|
77
|
+
version: "0"
|
|
78
|
+
requirement: *id004
|
|
79
|
+
prerelease: false
|
|
80
|
+
name: rake
|
|
65
81
|
type: :development
|
|
66
|
-
version_requirements: *id003
|
|
67
82
|
- !ruby/object:Gem::Dependency
|
|
68
|
-
|
|
83
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
84
|
+
none: false
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
hash: 37
|
|
89
|
+
segments:
|
|
90
|
+
- 0
|
|
91
|
+
- 13
|
|
92
|
+
- 7
|
|
93
|
+
version: 0.13.7
|
|
94
|
+
requirement: *id005
|
|
69
95
|
prerelease: false
|
|
70
|
-
|
|
96
|
+
name: thor
|
|
97
|
+
type: :runtime
|
|
98
|
+
- !ruby/object:Gem::Dependency
|
|
99
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
71
100
|
none: false
|
|
72
101
|
requirements:
|
|
73
102
|
- - ">="
|
|
74
103
|
- !ruby/object:Gem::Version
|
|
75
|
-
hash:
|
|
104
|
+
hash: 25
|
|
76
105
|
segments:
|
|
77
106
|
- 0
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
107
|
+
- 0
|
|
108
|
+
- 3
|
|
109
|
+
version: 0.0.3
|
|
110
|
+
requirement: *id006
|
|
111
|
+
prerelease: false
|
|
112
|
+
name: simple-statistics
|
|
113
|
+
type: :runtime
|
|
81
114
|
description: Inspired by bundler and rack. Mostly built on top of Alexey Kovyrin's loops code. http://github.com/kovyrin/loops
|
|
82
|
-
email:
|
|
115
|
+
email:
|
|
116
|
+
- glebpom@gmail.com
|
|
83
117
|
executables:
|
|
84
118
|
- daemonizer
|
|
85
119
|
extensions: []
|
|
86
120
|
|
|
87
|
-
extra_rdoc_files:
|
|
88
|
-
|
|
89
|
-
- README.md
|
|
121
|
+
extra_rdoc_files: []
|
|
122
|
+
|
|
90
123
|
files:
|
|
124
|
+
- .gitignore
|
|
125
|
+
- Gemfile
|
|
91
126
|
- LICENSE
|
|
92
127
|
- README.md
|
|
93
128
|
- ROADMAP
|
|
94
129
|
- Rakefile
|
|
95
|
-
- VERSION
|
|
96
130
|
- bin/daemonizer
|
|
97
131
|
- daemonizer.gemspec
|
|
98
132
|
- lib/daemonizer.rb
|
|
@@ -107,12 +141,22 @@ files:
|
|
|
107
141
|
- lib/daemonizer/option.rb
|
|
108
142
|
- lib/daemonizer/process_manager.rb
|
|
109
143
|
- lib/daemonizer/stats.rb
|
|
144
|
+
- lib/daemonizer/version.rb
|
|
110
145
|
- lib/daemonizer/worker.rb
|
|
111
146
|
- lib/daemonizer/worker_pool.rb
|
|
112
|
-
- spec/
|
|
147
|
+
- spec/cli/debugging_spec.rb
|
|
148
|
+
- spec/cli/not_started_spec.rb
|
|
149
|
+
- spec/cli/started_spec.rb
|
|
150
|
+
- spec/common/forking_spec.rb
|
|
151
|
+
- spec/settings/callbacks_spec.rb
|
|
152
|
+
- spec/settings/options_spec.rb
|
|
153
|
+
- spec/settings/pools_spec.rb
|
|
113
154
|
- spec/spec_helper.rb
|
|
114
|
-
- spec/
|
|
115
|
-
|
|
155
|
+
- spec/support/daemonfile_factory.rb
|
|
156
|
+
- spec/support/helpers.rb
|
|
157
|
+
- spec/support/path.rb
|
|
158
|
+
- spec/support/processes.rb
|
|
159
|
+
- spec/support/ruby_ext.rb
|
|
116
160
|
homepage: http://github.com/glebpom/daemonizer
|
|
117
161
|
licenses: []
|
|
118
162
|
|
|
@@ -133,19 +177,32 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
133
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
178
|
none: false
|
|
135
179
|
requirements:
|
|
136
|
-
- - "
|
|
180
|
+
- - ">"
|
|
137
181
|
- !ruby/object:Gem::Version
|
|
138
|
-
hash:
|
|
182
|
+
hash: 25
|
|
139
183
|
segments:
|
|
140
|
-
-
|
|
141
|
-
|
|
184
|
+
- 1
|
|
185
|
+
- 3
|
|
186
|
+
- 1
|
|
187
|
+
version: 1.3.1
|
|
142
188
|
requirements: []
|
|
143
189
|
|
|
144
|
-
rubyforge_project:
|
|
145
|
-
rubygems_version: 1.
|
|
190
|
+
rubyforge_project: daemonizer
|
|
191
|
+
rubygems_version: 1.8.10
|
|
146
192
|
signing_key:
|
|
147
193
|
specification_version: 3
|
|
148
194
|
summary: Daemonizer allows you to easily create custom daemons on ruby. Supporting prefork model
|
|
149
195
|
test_files:
|
|
196
|
+
- spec/cli/debugging_spec.rb
|
|
197
|
+
- spec/cli/not_started_spec.rb
|
|
198
|
+
- spec/cli/started_spec.rb
|
|
199
|
+
- spec/common/forking_spec.rb
|
|
200
|
+
- spec/settings/callbacks_spec.rb
|
|
201
|
+
- spec/settings/options_spec.rb
|
|
202
|
+
- spec/settings/pools_spec.rb
|
|
150
203
|
- spec/spec_helper.rb
|
|
151
|
-
- spec/
|
|
204
|
+
- spec/support/daemonfile_factory.rb
|
|
205
|
+
- spec/support/helpers.rb
|
|
206
|
+
- spec/support/path.rb
|
|
207
|
+
- spec/support/processes.rb
|
|
208
|
+
- spec/support/ruby_ext.rb
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.4.18
|
data/spec/spec.opts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|