resque_ui 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Gemfile +6 -0
  2. data/Gemfile.lock +102 -0
  3. data/History.txt +5 -0
  4. data/MIT-LICENSE +21 -0
  5. data/README.markdown +279 -0
  6. data/Rakefile +49 -0
  7. data/VERSION.yml +5 -0
  8. data/app/assets/images/idle.png +0 -0
  9. data/app/assets/images/poll.png +0 -0
  10. data/app/assets/images/working.png +0 -0
  11. data/app/assets/javascripts/resque/jquery-1.3.2.min.js +19 -0
  12. data/app/assets/javascripts/resque/jquery.relatize_date.js +95 -0
  13. data/app/assets/javascripts/resque/ranger.js +24 -0
  14. data/app/assets/stylesheets/resque/resque.css +93 -0
  15. data/app/assets/stylesheets/resque/resque_reset.css +48 -0
  16. data/app/controllers/resque_controller.rb +236 -0
  17. data/app/helpers/resque_helper.rb +107 -0
  18. data/app/views/layouts/resque.html.erb +39 -0
  19. data/app/views/resque/_key.html.erb +17 -0
  20. data/app/views/resque/_next_more.html.erb +10 -0
  21. data/app/views/resque/_queues.html.erb +52 -0
  22. data/app/views/resque/_status_styles.erb +98 -0
  23. data/app/views/resque/_workers.html.erb +110 -0
  24. data/app/views/resque/_working.html.erb +69 -0
  25. data/app/views/resque/delayed.html.erb +35 -0
  26. data/app/views/resque/delayed_timestamp.html.erb +26 -0
  27. data/app/views/resque/error.erb +1 -0
  28. data/app/views/resque/failed.html.erb +54 -0
  29. data/app/views/resque/overview.html.erb +4 -0
  30. data/app/views/resque/schedule.html.erb +96 -0
  31. data/app/views/resque/stats.html.erb +62 -0
  32. data/app/views/resque/status.html.erb +57 -0
  33. data/app/views/resque/statuses.html.erb +72 -0
  34. data/app/views/resque/workers.html.erb +1 -0
  35. data/lib/resque_ui/cap.rb +6 -0
  36. data/lib/resque_ui/cap_recipes.rb +106 -0
  37. data/lib/resque_ui/overrides/resque/failure/failure.rb +22 -0
  38. data/lib/resque_ui/overrides/resque/job.rb +12 -0
  39. data/lib/resque_ui/overrides/resque/resque.rb +8 -0
  40. data/lib/resque_ui/overrides/resque/worker.rb +230 -0
  41. data/lib/resque_ui/overrides/resque_scheduler/resque_scheduler.rb +58 -0
  42. data/lib/resque_ui/overrides/resque_status/chained_job_with_status.rb +24 -0
  43. data/lib/resque_ui/overrides/resque_status/job_with_status.rb +59 -0
  44. data/lib/resque_ui/overrides/resque_status/status.rb +53 -0
  45. data/lib/resque_ui.rb +26 -0
  46. data/lib/tasks/failure.rake +8 -0
  47. data/lib/tasks/scheduler.rake +11 -0
  48. data/lib/tasks/worker.rake +80 -0
  49. data/rdoc/Resque/ChainedJobWithStatus.html +284 -0
  50. data/rdoc/Resque/Failure/Base.html +229 -0
  51. data/rdoc/Resque/Failure.html +202 -0
  52. data/rdoc/Resque/Job.html +202 -0
  53. data/rdoc/Resque/JobWithStatus.html +410 -0
  54. data/rdoc/Resque/Status.html +368 -0
  55. data/rdoc/Resque/Worker.html +1104 -0
  56. data/rdoc/Resque.html +232 -0
  57. data/rdoc/ResqueScheduler.html +434 -0
  58. data/rdoc/ResqueUi/Cap.html +150 -0
  59. data/rdoc/ResqueUi/Engine.html +150 -0
  60. data/rdoc/ResqueUi.html +157 -0
  61. data/rdoc/created.rid +13 -0
  62. data/rdoc/images/brick.png +0 -0
  63. data/rdoc/images/brick_link.png +0 -0
  64. data/rdoc/images/bug.png +0 -0
  65. data/rdoc/images/bullet_black.png +0 -0
  66. data/rdoc/images/bullet_toggle_minus.png +0 -0
  67. data/rdoc/images/bullet_toggle_plus.png +0 -0
  68. data/rdoc/images/date.png +0 -0
  69. data/rdoc/images/find.png +0 -0
  70. data/rdoc/images/loadingAnimation.gif +0 -0
  71. data/rdoc/images/macFFBgHack.png +0 -0
  72. data/rdoc/images/package.png +0 -0
  73. data/rdoc/images/page_green.png +0 -0
  74. data/rdoc/images/page_white_text.png +0 -0
  75. data/rdoc/images/page_white_width.png +0 -0
  76. data/rdoc/images/plugin.png +0 -0
  77. data/rdoc/images/ruby.png +0 -0
  78. data/rdoc/images/tag_green.png +0 -0
  79. data/rdoc/images/wrench.png +0 -0
  80. data/rdoc/images/wrench_orange.png +0 -0
  81. data/rdoc/images/zoom.png +0 -0
  82. data/rdoc/index.html +163 -0
  83. data/rdoc/js/darkfish.js +116 -0
  84. data/rdoc/js/jquery.js +32 -0
  85. data/rdoc/js/quicksearch.js +114 -0
  86. data/rdoc/js/thickbox-compressed.js +10 -0
  87. data/rdoc/lib/resque_overrides_rb.html +54 -0
  88. data/rdoc/lib/resque_scheduler_overrides_rb.html +52 -0
  89. data/rdoc/lib/resque_status_overrides_rb.html +52 -0
  90. data/rdoc/lib/resque_ui/cap_rb.html +52 -0
  91. data/rdoc/lib/resque_ui/cap_recipes_rb.html +58 -0
  92. data/rdoc/lib/resque_ui/engine_rb.html +52 -0
  93. data/rdoc/lib/resque_ui/overrides/resque/failure/failure_rb.html +54 -0
  94. data/rdoc/lib/resque_ui/overrides/resque/job_rb.html +52 -0
  95. data/rdoc/lib/resque_ui/overrides/resque/resque_rb.html +52 -0
  96. data/rdoc/lib/resque_ui/overrides/resque/worker_rb.html +54 -0
  97. data/rdoc/lib/resque_ui/overrides/resque_scheduler/resque_scheduler_rb.html +52 -0
  98. data/rdoc/lib/resque_ui/overrides/resque_status/chained_job_with_status_rb.html +52 -0
  99. data/rdoc/lib/resque_ui/overrides/resque_status/job_with_status_rb.html +52 -0
  100. data/rdoc/lib/resque_ui/overrides/resque_status/status_rb.html +52 -0
  101. data/rdoc/lib/resque_ui/resque_ui_rb.html +52 -0
  102. data/rdoc/lib/resque_ui/tasks_rb.html +64 -0
  103. data/rdoc/lib/resque_ui_rb.html +76 -0
  104. data/rdoc/rdoc.css +763 -0
  105. data/resque_ui.gemspec +153 -0
  106. data/test/resque_ui_test.rb +8 -0
  107. data/test/test_helper.rb +3 -0
  108. metadata +205 -0
@@ -0,0 +1,368 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Resque::Status</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../lib/resque_ui/overrides/resque_status/status_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/resque_ui/overrides/resque_status/status.rb">lib/resque_ui/overrides/resque_status/status.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-clear">::clear</a></li>
69
+
70
+ <li><a href="#method-c-counter">::counter</a></li>
71
+
72
+ <li><a href="#method-c-counter_key">::counter_key</a></li>
73
+
74
+ <li><a href="#method-c-incr_counter">::incr_counter</a></li>
75
+
76
+ <li><a href="#method-c-status_ids">::status_ids</a></li>
77
+
78
+ </ul>
79
+ </div>
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="project-metadata">
86
+
87
+
88
+
89
+ <div id="classindex-section" class="section project-section">
90
+ <h3 class="section-header">Class/Module Index
91
+ <span class="search-toggle"><img src="../images/find.png"
92
+ height="16" width="16" alt="[+]"
93
+ title="show/hide quicksearch" /></span></h3>
94
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
95
+ <fieldset>
96
+ <legend>Quicksearch</legend>
97
+ <input type="text" name="quicksearch" value=""
98
+ class="quicksearch-field" />
99
+ </fieldset>
100
+ </form>
101
+
102
+ <ul class="link-list">
103
+
104
+ <li><a href="../Resque.html">Resque</a></li>
105
+
106
+ <li><a href="../Resque/ChainedJobWithStatus.html">Resque::ChainedJobWithStatus</a></li>
107
+
108
+ <li><a href="../Resque/Failure.html">Resque::Failure</a></li>
109
+
110
+ <li><a href="../Resque/Job.html">Resque::Job</a></li>
111
+
112
+ <li><a href="../Resque/JobWithStatus.html">Resque::JobWithStatus</a></li>
113
+
114
+ <li><a href="../Resque/Status.html">Resque::Status</a></li>
115
+
116
+ <li><a href="../Resque/Worker.html">Resque::Worker</a></li>
117
+
118
+ <li><a href="../ResqueUi.html">ResqueUi</a></li>
119
+
120
+ <li><a href="../ResqueUi/Cap.html">ResqueUi::Cap</a></li>
121
+
122
+ <li><a href="../ResqueUi/Engine.html">ResqueUi::Engine</a></li>
123
+
124
+ <li><a href="../ResqueScheduler.html">ResqueScheduler</a></li>
125
+
126
+ </ul>
127
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
128
+ </div>
129
+
130
+
131
+ </div>
132
+ </div>
133
+
134
+ <div id="documentation">
135
+ <h1 class="class">Resque::Status</h1>
136
+
137
+ <div id="description" class="description">
138
+
139
+ </div><!-- description -->
140
+
141
+
142
+
143
+
144
+ <div id="5Buntitled-5D" class="documentation-section">
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ <!-- Methods -->
154
+
155
+ <div id="public-class-method-details" class="method-section section">
156
+ <h3 class="section-header">Public Class Methods</h3>
157
+
158
+
159
+ <div id="clear-method" class="method-detail ">
160
+ <a name="method-c-clear"></a>
161
+
162
+
163
+ <div class="method-heading">
164
+ <span class="method-name">clear</span><span
165
+ class="method-args">(range_start = nil, range_end = nil)</span>
166
+ <span class="method-click-advice">click to toggle source</span>
167
+ </div>
168
+
169
+
170
+ <div class="method-description">
171
+
172
+ <p>clear statuses from redis passing an optional range. See `statuses` for
173
+ info about ranges</p>
174
+
175
+
176
+
177
+ <div class="method-source-code" id="clear-source">
178
+ <pre>
179
+ <span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/status.rb, line 25</span>
180
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">clear</span>(<span class="ruby-identifier">range_start</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">range_end</span> = <span class="ruby-keyword">nil</span>)
181
+ <span class="ruby-identifier">status_ids</span>(<span class="ruby-identifier">range_start</span>, <span class="ruby-identifier">range_end</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
182
+ <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">zrem</span>(<span class="ruby-identifier">set_key</span>, <span class="ruby-identifier">id</span>)
183
+ <span class="ruby-constant">Resque</span>.<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">keys</span>(<span class="ruby-node">&quot;*#{id}&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
184
+ <span class="ruby-constant">Resque</span>.<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">del</span>(<span class="ruby-identifier">key</span>)
185
+ <span class="ruby-keyword">end</span>
186
+ <span class="ruby-keyword">end</span>
187
+ <span class="ruby-keyword">end</span></pre>
188
+ </div><!-- clear-source -->
189
+
190
+ </div>
191
+
192
+
193
+
194
+
195
+ </div><!-- clear-method -->
196
+
197
+
198
+ <div id="counter-method" class="method-detail ">
199
+ <a name="method-c-counter"></a>
200
+
201
+
202
+ <div class="method-heading">
203
+ <span class="method-name">counter</span><span
204
+ class="method-args">(counter, uuid)</span>
205
+ <span class="method-click-advice">click to toggle source</span>
206
+ </div>
207
+
208
+
209
+ <div class="method-description">
210
+
211
+
212
+
213
+
214
+
215
+ <div class="method-source-code" id="counter-source">
216
+ <pre>
217
+ <span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/status.rb, line 40</span>
218
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">counter</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
219
+ <span class="ruby-identifier">redis</span>[<span class="ruby-identifier">counter_key</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)].<span class="ruby-identifier">to_i</span>
220
+ <span class="ruby-keyword">end</span></pre>
221
+ </div><!-- counter-source -->
222
+
223
+ </div>
224
+
225
+
226
+
227
+
228
+ </div><!-- counter-method -->
229
+
230
+
231
+ <div id="counter_key-method" class="method-detail ">
232
+ <a name="method-c-counter_key"></a>
233
+
234
+
235
+ <div class="method-heading">
236
+ <span class="method-name">counter_key</span><span
237
+ class="method-args">(counter, uuid)</span>
238
+ <span class="method-click-advice">click to toggle source</span>
239
+ </div>
240
+
241
+
242
+ <div class="method-description">
243
+
244
+ <p>If multiple workers are running at once and you need an incrementer, you
245
+ can’t use the status’ num attribute because of race conditions. You can
246
+ use a counter and call incr on it instead</p>
247
+
248
+
249
+
250
+ <div class="method-source-code" id="counter_key-source">
251
+ <pre>
252
+ <span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/status.rb, line 36</span>
253
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">counter_key</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
254
+ <span class="ruby-node">&quot;#{counter}:#{uuid}&quot;</span>
255
+ <span class="ruby-keyword">end</span></pre>
256
+ </div><!-- counter_key-source -->
257
+
258
+ </div>
259
+
260
+
261
+
262
+
263
+ </div><!-- counter_key-method -->
264
+
265
+
266
+ <div id="incr_counter-method" class="method-detail ">
267
+ <a name="method-c-incr_counter"></a>
268
+
269
+
270
+ <div class="method-heading">
271
+ <span class="method-name">incr_counter</span><span
272
+ class="method-args">(counter, uuid)</span>
273
+ <span class="method-click-advice">click to toggle source</span>
274
+ </div>
275
+
276
+
277
+ <div class="method-description">
278
+
279
+
280
+
281
+
282
+
283
+ <div class="method-source-code" id="incr_counter-source">
284
+ <pre>
285
+ <span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/status.rb, line 44</span>
286
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">incr_counter</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
287
+ <span class="ruby-identifier">key</span> = <span class="ruby-identifier">counter_key</span>(<span class="ruby-identifier">counter</span>, <span class="ruby-identifier">uuid</span>)
288
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">incr</span>(<span class="ruby-identifier">key</span>)
289
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">expire_in</span>
290
+ <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">expire</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">expire_in</span>)
291
+ <span class="ruby-keyword">end</span>
292
+ <span class="ruby-identifier">n</span>
293
+ <span class="ruby-keyword">end</span></pre>
294
+ </div><!-- incr_counter-source -->
295
+
296
+ </div>
297
+
298
+
299
+
300
+
301
+ </div><!-- incr_counter-method -->
302
+
303
+
304
+ <div id="status_ids-method" class="method-detail ">
305
+ <a name="method-c-status_ids"></a>
306
+
307
+
308
+ <div class="method-heading">
309
+ <span class="method-name">status_ids</span><span
310
+ class="method-args">(range_start = nil, range_end = nil)</span>
311
+ <span class="method-click-advice">click to toggle source</span>
312
+ </div>
313
+
314
+
315
+ <div class="method-description">
316
+
317
+ <pre>Return the &lt;tt&gt;num&lt;/tt&gt; most recent status/job UUIDs in reverse chronological order.</pre>
318
+
319
+ <p>override the gem to fix the ordering</p>
320
+
321
+
322
+
323
+ <div class="method-source-code" id="status_ids-source">
324
+ <pre>
325
+ <span class="ruby-comment"># File lib/resque_ui/overrides/resque_status/status.rb, line 5</span>
326
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">status_ids</span>(<span class="ruby-identifier">range_start</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">range_end</span> = <span class="ruby-keyword">nil</span>)
327
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">range_end</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">range_start</span>
328
+ <span class="ruby-comment"># Because we want a reverse chronological order, we need to get a range starting</span>
329
+ <span class="ruby-comment"># by the higest negative number.</span>
330
+ <span class="ruby-identifier">redis</span>.<span class="ruby-identifier">zrevrange</span>(<span class="ruby-identifier">set_key</span>, <span class="ruby-value">0</span>, <span class="ruby-value">-1</span>) <span class="ruby-operator">||</span> []
331
+ <span class="ruby-keyword">else</span>
332
+ <span class="ruby-comment"># Because we want a reverse chronological order, we need to get a range starting</span>
333
+ <span class="ruby-comment"># by the higest negative number. The ordering is transparent from the API user's</span>
334
+ <span class="ruby-comment"># perspective so we need to convert the passed params</span>
335
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">range_start</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
336
+ <span class="ruby-identifier">range_start</span> = <span class="ruby-value">-1</span>
337
+ <span class="ruby-keyword">else</span>
338
+ <span class="ruby-identifier">range_start</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
339
+ <span class="ruby-keyword">end</span>
340
+ (<span class="ruby-identifier">redis</span>.<span class="ruby-identifier">zrange</span>(<span class="ruby-identifier">set_key</span>, <span class="ruby-operator">-</span>(<span class="ruby-identifier">range_end</span>.<span class="ruby-identifier">abs</span>), <span class="ruby-operator">-</span>(<span class="ruby-identifier">range_start</span>.<span class="ruby-identifier">abs</span>)) <span class="ruby-operator">||</span> []).<span class="ruby-identifier">reverse</span>
341
+ <span class="ruby-keyword">end</span>
342
+ <span class="ruby-keyword">end</span></pre>
343
+ </div><!-- status_ids-source -->
344
+
345
+ </div>
346
+
347
+
348
+
349
+
350
+ </div><!-- status_ids-method -->
351
+
352
+
353
+ </div><!-- public-class-method-details -->
354
+
355
+ </div><!-- 5Buntitled-5D -->
356
+
357
+
358
+ </div><!-- documentation -->
359
+
360
+ <div id="validator-badges">
361
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
362
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
363
+ Rdoc Generator</a> 2</small>.</p>
364
+ </div>
365
+
366
+ </body>
367
+ </html>
368
+