resque-pool-dynamic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,318 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <base id="base_target" target="_parent" />
19
+ </head>
20
+ <body>
21
+ <script type="text/javascript" charset="utf-8">
22
+ if (window.top.frames.main) {
23
+ document.getElementById('base_target').target = 'main';
24
+ document.body.className = 'frames';
25
+ }
26
+ </script>
27
+ <div id="content">
28
+ <h1 id="full_list_header">Method List</h1>
29
+ <div id="nav">
30
+
31
+ <a target="_self" href="class_list.html">Classes</a>
32
+
33
+ <a target="_self" href="method_list.html">Methods</a>
34
+
35
+ <a target="_self" href="file_list.html">Files</a>
36
+
37
+ </div>
38
+ <div id="search">Search: <input type="text" /></div>
39
+
40
+ <ul id="full_list" class="methods">
41
+
42
+
43
+ <li class="r1 ">
44
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#alive%3F-instance_method" title="Resque::Pool::Dynamic::Logfile#alive? (method)">#alive?</a></span>
45
+
46
+ <small>Resque::Pool::Dynamic::Logfile</small>
47
+
48
+ </li>
49
+
50
+
51
+ <li class="r2 ">
52
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#config-instance_method" title="Resque::Pool::Dynamic#config (method)">#config</a></span>
53
+
54
+ <small>Resque::Pool::Dynamic</small>
55
+
56
+ </li>
57
+
58
+
59
+ <li class="r1 ">
60
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#config_path-instance_method" title="Resque::Pool::Dynamic#config_path (method)">#config_path</a></span>
61
+
62
+ <small>Resque::Pool::Dynamic</small>
63
+
64
+ </li>
65
+
66
+
67
+ <li class="r2 ">
68
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#config_tempfile-instance_method" title="Resque::Pool::Dynamic#config_tempfile (method)">#config_tempfile</a></span>
69
+
70
+ <small>Resque::Pool::Dynamic</small>
71
+
72
+ </li>
73
+
74
+
75
+ <li class="r1 ">
76
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Shell.html#eval_input-instance_method" title="Resque::Pool::Dynamic::Shell#eval_input (method)">#eval_input</a></span>
77
+
78
+ <small>Resque::Pool::Dynamic::Shell</small>
79
+
80
+ </li>
81
+
82
+
83
+ <li class="r2 ">
84
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#has_log%3F-instance_method" title="Resque::Pool::Dynamic#has_log? (method)">#has_log?</a></span>
85
+
86
+ <small>Resque::Pool::Dynamic</small>
87
+
88
+ </li>
89
+
90
+
91
+ <li class="r1 ">
92
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Shell.html#help-instance_method" title="Resque::Pool::Dynamic::Shell#help (method)">#help</a></span>
93
+
94
+ <small>Resque::Pool::Dynamic::Shell</small>
95
+
96
+ </li>
97
+
98
+
99
+ <li class="r2 ">
100
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#initialize-instance_method" title="Resque::Pool::Dynamic#initialize (method)">#initialize</a></span>
101
+
102
+ <small>Resque::Pool::Dynamic</small>
103
+
104
+ </li>
105
+
106
+
107
+ <li class="r1 ">
108
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#kill%21-instance_method" title="Resque::Pool::Dynamic#kill! (method)">#kill!</a></span>
109
+
110
+ <small>Resque::Pool::Dynamic</small>
111
+
112
+ </li>
113
+
114
+
115
+ <li class="r2 ">
116
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#log-instance_method" title="Resque::Pool::Dynamic#log (method)">#log</a></span>
117
+
118
+ <small>Resque::Pool::Dynamic</small>
119
+
120
+ </li>
121
+
122
+
123
+ <li class="r1 ">
124
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#log_path-instance_method" title="Resque::Pool::Dynamic#log_path (method)">#log_path</a></span>
125
+
126
+ <small>Resque::Pool::Dynamic</small>
127
+
128
+ </li>
129
+
130
+
131
+ <li class="r2 ">
132
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#loop_with_index-instance_method" title="Resque::Pool::Dynamic#loop_with_index (method)">#loop_with_index</a></span>
133
+
134
+ <small>Resque::Pool::Dynamic</small>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="r1 ">
140
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#open-class_method" title="Resque::Pool::Dynamic::Logfile.open (method)">open</a></span>
141
+
142
+ <small>Resque::Pool::Dynamic::Logfile</small>
143
+
144
+ </li>
145
+
146
+
147
+ <li class="r2 ">
148
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#parse_config_string-instance_method" title="Resque::Pool::Dynamic#parse_config_string (method)">#parse_config_string</a></span>
149
+
150
+ <small>Resque::Pool::Dynamic</small>
151
+
152
+ </li>
153
+
154
+
155
+ <li class="r1 ">
156
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#pid-instance_method" title="Resque::Pool::Dynamic::Logfile#pid (method)">#pid</a></span>
157
+
158
+ <small>Resque::Pool::Dynamic::Logfile</small>
159
+
160
+ </li>
161
+
162
+
163
+ <li class="r2 ">
164
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#pid-instance_method" title="Resque::Pool::Dynamic#pid (method)">#pid</a></span>
165
+
166
+ <small>Resque::Pool::Dynamic</small>
167
+
168
+ </li>
169
+
170
+
171
+ <li class="r1 ">
172
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#pid%21-instance_method" title="Resque::Pool::Dynamic#pid! (method)">#pid!</a></span>
173
+
174
+ <small>Resque::Pool::Dynamic</small>
175
+
176
+ </li>
177
+
178
+
179
+ <li class="r2 ">
180
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Shell.html#print_eval_error-instance_method" title="Resque::Pool::Dynamic::Shell#print_eval_error (method)">#print_eval_error</a></span>
181
+
182
+ <small>Resque::Pool::Dynamic::Shell</small>
183
+
184
+ </li>
185
+
186
+
187
+ <li class="r1 ">
188
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Shell.html#print_result-instance_method" title="Resque::Pool::Dynamic::Shell#print_result (method)">#print_result</a></span>
189
+
190
+ <small>Resque::Pool::Dynamic::Shell</small>
191
+
192
+ </li>
193
+
194
+
195
+ <li class="r2 ">
196
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#pstree-instance_method" title="Resque::Pool::Dynamic#pstree (method)">#pstree</a></span>
197
+
198
+ <small>Resque::Pool::Dynamic</small>
199
+
200
+ </li>
201
+
202
+
203
+ <li class="r1 ">
204
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#reload-instance_method" title="Resque::Pool::Dynamic#reload (method)">#reload</a></span>
205
+
206
+ <small>Resque::Pool::Dynamic</small>
207
+
208
+ </li>
209
+
210
+
211
+ <li class="r2 ">
212
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#restat-instance_method" title="Resque::Pool::Dynamic::Logfile#restat (method)">#restat</a></span>
213
+
214
+ <small>Resque::Pool::Dynamic::Logfile</small>
215
+
216
+ </li>
217
+
218
+
219
+ <li class="r1 ">
220
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Shell.html#run-class_method" title="Resque::Pool::Dynamic::Shell.run (method)">run</a></span>
221
+
222
+ <small>Resque::Pool::Dynamic::Shell</small>
223
+
224
+ </li>
225
+
226
+
227
+ <li class="r2 ">
228
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#run_pool-instance_method" title="Resque::Pool::Dynamic#run_pool (method)">#run_pool</a></span>
229
+
230
+ <small>Resque::Pool::Dynamic</small>
231
+
232
+ </li>
233
+
234
+
235
+ <li class="r1 ">
236
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#shell-class_method" title="Resque::Pool::Dynamic.shell (method)">shell</a></span>
237
+
238
+ <small>Resque::Pool::Dynamic</small>
239
+
240
+ </li>
241
+
242
+
243
+ <li class="r2 ">
244
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#start-instance_method" title="Resque::Pool::Dynamic#start (method)">#start</a></span>
245
+
246
+ <small>Resque::Pool::Dynamic</small>
247
+
248
+ </li>
249
+
250
+
251
+ <li class="r1 ">
252
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#start%21-instance_method" title="Resque::Pool::Dynamic#start! (method)">#start!</a></span>
253
+
254
+ <small>Resque::Pool::Dynamic</small>
255
+
256
+ </li>
257
+
258
+
259
+ <li class="r2 ">
260
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#status-instance_method" title="Resque::Pool::Dynamic#status (method)">#status</a></span>
261
+
262
+ <small>Resque::Pool::Dynamic</small>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="r1 ">
268
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#stop-instance_method" title="Resque::Pool::Dynamic#stop (method)">#stop</a></span>
269
+
270
+ <small>Resque::Pool::Dynamic</small>
271
+
272
+ </li>
273
+
274
+
275
+ <li class="r2 ">
276
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#stop%21-instance_method" title="Resque::Pool::Dynamic#stop! (method)">#stop!</a></span>
277
+
278
+ <small>Resque::Pool::Dynamic</small>
279
+
280
+ </li>
281
+
282
+
283
+ <li class="r1 ">
284
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#tail-instance_method" title="Resque::Pool::Dynamic::Logfile#tail (method)">#tail</a></span>
285
+
286
+ <small>Resque::Pool::Dynamic::Logfile</small>
287
+
288
+ </li>
289
+
290
+
291
+ <li class="r2 ">
292
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#tail_to_eof-instance_method" title="Resque::Pool::Dynamic::Logfile#tail_to_eof (method)">#tail_to_eof</a></span>
293
+
294
+ <small>Resque::Pool::Dynamic::Logfile</small>
295
+
296
+ </li>
297
+
298
+
299
+ <li class="r1 ">
300
+ <span class='object_link'><a href="Resque/Pool/Dynamic/Logfile.html#tail_until-instance_method" title="Resque::Pool::Dynamic::Logfile#tail_until (method)">#tail_until</a></span>
301
+
302
+ <small>Resque::Pool::Dynamic::Logfile</small>
303
+
304
+ </li>
305
+
306
+
307
+ <li class="r2 ">
308
+ <span class='object_link'><a href="Resque/Pool/Dynamic.html#write_config-instance_method" title="Resque::Pool::Dynamic#write_config (method)">#write_config</a></span>
309
+
310
+ <small>Resque::Pool::Dynamic</small>
311
+
312
+ </li>
313
+
314
+
315
+ </ul>
316
+ </div>
317
+ </body>
318
+ </html>
@@ -0,0 +1,105 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.7.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html">Index</a> &raquo;
37
+
38
+
39
+ <span class="title">Top Level Namespace</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Top Level Namespace
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ </dl>
75
+ <div class="clear"></div>
76
+
77
+ <h2>Defined Under Namespace</h2>
78
+ <p class="children">
79
+
80
+
81
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Resque.html" title="Resque (module)">Resque</a></span>
82
+
83
+
84
+
85
+
86
+ </p>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ </div>
97
+
98
+ <div id="footer">
99
+ Generated on Wed Apr 25 21:03:03 2012 by
100
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
101
+ 0.7.5 (ruby-1.9.2).
102
+ </div>
103
+
104
+ </body>
105
+ </html>
data/help.yml ADDED
@@ -0,0 +1,140 @@
1
+ ---
2
+ ! '#help':
3
+ :summary: ''
4
+ :format: ! "---------------------------------- Method: #help (Resque::Pool::Dynamic)\n
5
+ \ (Defined in: lib/resque/pool/dynamic.rb)\n\n dynamic.help(subject
6
+ = nil) \n------------------------------------------------------------------------\n\n
7
+ \ \n\n\n"
8
+ ! '#pid':
9
+ :summary: PID of the resque-pool process if running.
10
+ :format: ! "----------------------------------- Method: #pid (Resque::Pool::Dynamic)\n
11
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.pid
12
+ (readonly)\n------------------------------------------------------------------------\n\n
13
+ \ PID of the resque-pool process if running \n\n\n\n"
14
+ ! '#config_path':
15
+ :summary: Path to the temporary config file.
16
+ :format: ! "--------------------------- Method: #config_path (Resque::Pool::Dynamic)\n
17
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.config_path
18
+ \n------------------------------------------------------------------------\n\n
19
+ \ Path to the temporary config file \n\n\n\n"
20
+ ! '#initial_config':
21
+ :summary: Initial configuration.
22
+ :format: ! "------------------------ Method: #initial_config (Resque::Pool::Dynamic)\n
23
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.initial_config(spec)
24
+ \n------------------------------------------------------------------------\n\n
25
+ \ Initial configuration \n\n\n\n"
26
+ ! '#config':
27
+ :summary: Show or update configuration.
28
+ :format: ! "-------------------------------- Method: #config (Resque::Pool::Dynamic)\n
29
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.config(args
30
+ = nil) \n------------------------------------------------------------------------\n\n
31
+ \ Show or update configuration \n\n\n\n"
32
+ ! '#write_config':
33
+ :summary: Write temporary configuration file.
34
+ :format: ! "-------------------------- Method: #write_config (Resque::Pool::Dynamic)\n
35
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.write_config
36
+ \n------------------------------------------------------------------------\n\n
37
+ \ Write temporary configuration file \n\n\n\n"
38
+ ! '#start!':
39
+ :summary: Start resque-pool child.
40
+ :format: ! "-------------------------------- Method: #start! (Resque::Pool::Dynamic)\n
41
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.start!
42
+ \n------------------------------------------------------------------------\n\n
43
+ \ Start resque-pool child \n\n\n\n"
44
+ ! '#start':
45
+ :summary: Start resque-pool, showing startup logs.
46
+ :format: ! "--------------------------------- Method: #start (Resque::Pool::Dynamic)\n
47
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.start
48
+ \n------------------------------------------------------------------------\n\n
49
+ \ Start resque-pool, showing startup logs \n\n\n\n"
50
+ ! '#kill!':
51
+ :summary: Send signal to a running resque-pool.
52
+ :format: ! "--------------------------------- Method: #kill! (Resque::Pool::Dynamic)\n
53
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.kill!(sig)
54
+ \n------------------------------------------------------------------------\n\n
55
+ \ Send signal to a running resque-pool \n\n\n\n"
56
+ ! '#stop!':
57
+ :summary: Stop running resque-pool.
58
+ :format: ! "--------------------------------- Method: #stop! (Resque::Pool::Dynamic)\n
59
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.stop!
60
+ \n------------------------------------------------------------------------\n\n
61
+ \ Stop running resque-pool \n\n\n\n"
62
+ ! '#stop':
63
+ :summary: Stop running resque-pool, show shutdown logs.
64
+ :format: ! "---------------------------------- Method: #stop (Resque::Pool::Dynamic)\n
65
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.stop
66
+ \n------------------------------------------------------------------------\n\n
67
+ \ Stop running resque-pool, show shutdown logs \n\n\n\n"
68
+ ! '#reload':
69
+ :summary: Reload configuration.
70
+ :format: ! "-------------------------------- Method: #reload (Resque::Pool::Dynamic)\n
71
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.reload
72
+ \n------------------------------------------------------------------------\n\n
73
+ \ Reload configuration \n\n\n\n"
74
+ ! '#pstree':
75
+ :summary: Show child process tree.
76
+ :format: ! "-------------------------------- Method: #pstree (Resque::Pool::Dynamic)\n
77
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.pstree
78
+ \n------------------------------------------------------------------------\n\n
79
+ \ Show child process tree \n\n\n\n"
80
+ ! '#status':
81
+ :summary: Show current status.
82
+ :format: ! "-------------------------------- Method: #status (Resque::Pool::Dynamic)\n
83
+ \ (Defined in: lib/resque/pool/dynamic/process.rb)\n\n dynamic.status
84
+ \n------------------------------------------------------------------------\n\n
85
+ \ Show current status \n\n\n\n"
86
+ ! '#log_path':
87
+ :summary: Path to the log file.
88
+ :format: ! "------------------------------ Method: #log_path (Resque::Pool::Dynamic)\n
89
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n dynamic.log_path
90
+ \n------------------------------------------------------------------------\n\n
91
+ \ Path to the log file \n\n\n\n"
92
+ ! '#log':
93
+ :summary: Open Logfile instance.
94
+ :format: ! "----------------------------------- Method: #log (Resque::Pool::Dynamic)\n
95
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n dynamic.log
96
+ \n------------------------------------------------------------------------\n\n
97
+ \ Open Logfile instance \n\n\n\n"
98
+ ! '#has_log?':
99
+ :summary: True if we have an open log file.
100
+ :format: ! "------------------------------ Method: #has_log? (Resque::Pool::Dynamic)\n
101
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n dynamic.has_log?
102
+ -> Boolean \n------------------------------------------------------------------------\n\n
103
+ \ True if we have an open log file \n\nReturns:\n--------\n\n (Boolean) -
104
+ \n\n\n\n"
105
+ Logfile#tail:
106
+ :summary: Show last n lines of the file, or follow the file.
107
+ :format: ! "------------------------- Method: #tail (Resque::Pool::Dynamic::Logfile)\n
108
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.tail(n
109
+ = nil, &block) \n------------------------------------------------------------------------\n\n
110
+ \ Show last n lines of the file, or follow the file \n\n\n\n"
111
+ Logfile#tail_until:
112
+ :summary: Follow the file until a line matches regexp.
113
+ :format: ! "------------------- Method: #tail_until (Resque::Pool::Dynamic::Logfile)\n
114
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.tail_until(rx)
115
+ \n------------------------------------------------------------------------\n\n
116
+ \ Follow the file until a line matches regexp \n\n\n\n"
117
+ Logfile#tail_to_eof:
118
+ :summary: Print contents of the file until current end of file.
119
+ :format: ! "------------------ Method: #tail_to_eof (Resque::Pool::Dynamic::Logfile)\n
120
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.tail_to_eof
121
+ \n------------------------------------------------------------------------\n\n
122
+ \ Print contents of the file until current end of file \n\n\n\n"
123
+ Logfile#ff:
124
+ :summary: Fast forward until end of file.
125
+ :format: ! "--------------------------- Method: #ff (Resque::Pool::Dynamic::Logfile)\n
126
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.ff
127
+ \n------------------------------------------------------------------------\n\n
128
+ \ Fast forward until end of file \n\n\n\n"
129
+ Logfile#rew:
130
+ :summary: Rewind until beginning of file.
131
+ :format: ! "-------------------------- Method: #rew (Resque::Pool::Dynamic::Logfile)\n
132
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.rew
133
+ \n------------------------------------------------------------------------\n\n
134
+ \ Rewind until beginning of file \n\n\n\n"
135
+ Logfile#rewind:
136
+ :summary: Rewind until beginning of file.
137
+ :format: ! "----------------------- Method: #rewind (Resque::Pool::Dynamic::Logfile)\n
138
+ \ (Defined in: lib/resque/pool/dynamic/logfile.rb)\n\n logfile.rewind
139
+ \n------------------------------------------------------------------------\n\n
140
+ \ Rewind until beginning of file \n\n\n\n"
@@ -0,0 +1,97 @@
1
+ require 'io-tail'
2
+
3
+ module Resque
4
+ class Pool
5
+ class Dynamic
6
+ # Logfile path
7
+ # @return [String] Path to the log file
8
+ # @api cli
9
+ def log_path
10
+ # pid! call will raise an exception if process is not running yet
11
+ @log_path ||= ENV['RESQUE_POOL_LOG'] || "resque-pool.#{pid!}.log"
12
+ end
13
+
14
+ # Open log of resque-pool process
15
+ # @return [Logfile] Logfile instance
16
+ # @api cli
17
+ def log
18
+ # pid! call will raise an exception if process is not running yet
19
+ @log ||= Logfile.open(log_path, :pid => pid!)
20
+ end
21
+
22
+ # True if we have an open log file
23
+ # @api cli
24
+ def has_log?
25
+ !!@log
26
+ end
27
+
28
+ # Slightly customized tailable file class
29
+ class Logfile < IO::Tail::Logfile
30
+ # PID of process that writes the log file
31
+ # @return [Integer, NilClass]
32
+ attr_accessor :pid
33
+
34
+ def self.open(filename, opts = {}, &block)
35
+ raise "Need :pid" unless opts.has_key? :pid
36
+ super
37
+ end
38
+
39
+ # True if child process is alive
40
+ def alive?
41
+ Process.getpgid(pid) rescue nil
42
+ end
43
+
44
+ # Make sure to return on EOF if process is dead
45
+ def restat
46
+ self.return_if_eof = true unless alive?
47
+ super
48
+ end
49
+
50
+ # Show last n lines of the file, or follow the file
51
+ # @param [Integer, NilClass] n Number of lines or nil
52
+ # @yield [ln] Called for every line of file
53
+ # @yieldparam [String] ln Input line
54
+ # @api cli
55
+ def tail(n = nil, &block)
56
+ super(n) do |ln|
57
+ $stderr.puts ln
58
+ block.call(ln) if block
59
+ end
60
+ rescue Interrupt => e
61
+ nil
62
+ end
63
+
64
+ # Follow the file until a line matches regexp
65
+ # @api cli
66
+ def tail_until(rx)
67
+ self.tail do |ln|
68
+ raise IO::Tail::ReturnException if ln =~ rx
69
+ end
70
+ end
71
+
72
+ # Print contents of the file until current end of file
73
+ # @api cli
74
+ def tail_to_eof
75
+ orig_return_if_eof, return_if_eof = return_if_eof, true
76
+ tail
77
+ ensure
78
+ return_if_eof = orig_return_if_eof
79
+ end
80
+
81
+ # convenience
82
+
83
+ # Fast forward until end of file (see IO::Tail#backward)
84
+ # @api cli
85
+ alias_method :ff, :backward
86
+
87
+ # Rewind until beginning of file (see IO::Tail#forward)
88
+ # @api cli
89
+ alias_method :rew, :forward
90
+
91
+ # Rewind until beginning of file (see IO::Tail#forward)
92
+ # @api cli
93
+ alias_method :rewind, :forward
94
+ end
95
+ end
96
+ end
97
+ end