delayed-web 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/delayed/web/jobs_controller.rb +0 -10
  3. data/app/decorators/delayed/web/active_record_decorator.rb +0 -4
  4. data/app/decorators/delayed/web/status_decorator.rb +1 -5
  5. data/app/models/delayed/web/job/double.rb +0 -4
  6. data/app/models/delayed/web/job/mongoid.rb +24 -0
  7. data/app/views/delayed/web/jobs/index.html.erb +2 -11
  8. data/app/views/delayed/web/jobs/show.html.erb +1 -4
  9. data/app/views/layouts/delayed/web/application.html.erb +0 -1
  10. data/config/locales/en.yml +0 -3
  11. data/config/routes.rb +0 -1
  12. data/lib/delayed/web/version.rb +1 -1
  13. data/spec/decorators/status_decorator_spec.rb +2 -16
  14. data/spec/dummy/db/development.sqlite3 +0 -0
  15. data/spec/dummy/db/test.sqlite3 +0 -0
  16. data/spec/dummy/log/development.log +32486 -0
  17. data/spec/dummy/log/test.log +927 -0
  18. data/spec/dummy/tmp/cache/assets/development/sprockets/0332f562ff3e30cda56eb6010d3d4952 +0 -0
  19. data/spec/dummy/tmp/cache/assets/development/sprockets/075cd664f24b531d19fa91317ef97eec +0 -0
  20. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  21. data/spec/dummy/tmp/cache/assets/development/sprockets/14530c1c82b7977b9d8c442d5954a6b1 +0 -0
  22. data/spec/dummy/tmp/cache/assets/development/sprockets/209d539bd215846261a8891dd525ec4a +0 -0
  23. data/spec/dummy/tmp/cache/assets/development/sprockets/2b6d7fa94bd05e45215f128721db34e3 +0 -0
  24. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  25. data/spec/dummy/tmp/cache/assets/development/sprockets/342153d354456f6627073c2b6271db5a +0 -0
  26. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  27. data/spec/dummy/tmp/cache/assets/development/sprockets/3c9123c2b52806585f33904c0f3111b0 +0 -0
  28. data/spec/dummy/tmp/cache/assets/development/sprockets/4db6b13287795e859f19978360c1fd0e +0 -0
  29. data/spec/dummy/tmp/cache/assets/development/sprockets/5469cff1c301f3271083dfef71ab1794 +0 -0
  30. data/spec/dummy/tmp/cache/assets/development/sprockets/7437b83a2bf92170949593c06096d785 +0 -0
  31. data/spec/dummy/tmp/cache/assets/development/sprockets/8fa08b833277f69ba9c690fccd8f5702 +0 -0
  32. data/spec/dummy/tmp/cache/assets/development/sprockets/a44209b0d8d5c66ceeef04dacbc7cf1b +0 -0
  33. data/spec/dummy/tmp/cache/assets/development/sprockets/a5108c801777656bd9063abb9849ad55 +0 -0
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/ad4f58431d190a3f58b681aa163b5979 +0 -0
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/ae02292af637b0ca9807b59076a87282 +0 -0
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/b6232d3fa8288b4d714ae250bf4e7acc +0 -0
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/ba98100d11384e930583f1385f48a94b +0 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/d6e1313228ec89666a543b748171f6b6 +0 -0
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/d8f3c4e12078655828fafa63ef446a2e +0 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/e7905ee7f75f526588d5bed6996c2cde +0 -0
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/ea9a9e3e949584a04377ce58b2fd61b6 +0 -0
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  45. data/spec/dummy/tmp/cache/assets/test/sprockets/14530c1c82b7977b9d8c442d5954a6b1 +0 -0
  46. data/spec/dummy/tmp/cache/assets/test/sprockets/209d539bd215846261a8891dd525ec4a +0 -0
  47. data/spec/dummy/tmp/cache/assets/test/sprockets/2b6d7fa94bd05e45215f128721db34e3 +0 -0
  48. data/spec/dummy/tmp/cache/assets/test/sprockets/3c9123c2b52806585f33904c0f3111b0 +0 -0
  49. data/spec/dummy/tmp/cache/assets/test/sprockets/4db6b13287795e859f19978360c1fd0e +0 -0
  50. data/spec/dummy/tmp/cache/assets/test/sprockets/7437b83a2bf92170949593c06096d785 +0 -0
  51. data/spec/dummy/tmp/cache/assets/test/sprockets/8fa08b833277f69ba9c690fccd8f5702 +0 -0
  52. data/spec/dummy/tmp/cache/assets/test/sprockets/a44209b0d8d5c66ceeef04dacbc7cf1b +0 -0
  53. data/spec/dummy/tmp/cache/assets/test/sprockets/ad4f58431d190a3f58b681aa163b5979 +0 -0
  54. data/spec/dummy/tmp/cache/assets/test/sprockets/ae02292af637b0ca9807b59076a87282 +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/b6232d3fa8288b4d714ae250bf4e7acc +0 -0
  56. data/spec/dummy/tmp/cache/assets/test/sprockets/d6e1313228ec89666a543b748171f6b6 +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/d8f3c4e12078655828fafa63ef446a2e +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/e7905ee7f75f526588d5bed6996c2cde +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/ea9a9e3e949584a04377ce58b2fd61b6 +0 -0
  60. data/spec/features/jobs_spec.rb +0 -7
  61. metadata +98 -7
  62. data/app/assets/javascripts/delayed/web/application.js +0 -45
  63. data/app/assets/javascripts/jquery-1.11.1.min.js +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 935453f8f9b38036058aafef77497d647a50e15b
4
- data.tar.gz: e9285fe594414a60123d0ac3ebfb48e04ee71259
3
+ metadata.gz: dd66d05ef2a11a4adf4cf9e3e3de06b25662cd63
4
+ data.tar.gz: 61e2fa4a7b7f861db38fa13f04e42fed1dd31c01
5
5
  SHA512:
6
- metadata.gz: b74eb09404b8a3c582a078b18c37f179efd5ff80ebd935e2249102d3e7c75e20eabadfe2d8c1d1302ed32ab1b116d0bc1a07fc1f13c409ba5393f26c1e746f25
7
- data.tar.gz: c60be9c1612338a4ef9b002976eeda760b3e052e20aa38b49f556bad1dffb9c6c06549fd4ccd33319bbe4d28d22641e058433266279210025f139ef02ef46122
6
+ metadata.gz: eac0eb772a06388b98c5649fb64a067152dab24a69f8104f66bbda9acf9b9ac7c6e40e3abd7685d3011c22cf527888a8ffd10fa806eae679bd15ab6837f6aa3e
7
+ data.tar.gz: 424138ac419742487d80f19a67acb62bd52c0cdfa664590a1da19a235b03e5ba789568b7485d44ba8d941cede50b46b31752a335056fa1d327f3377f80d0e83b
@@ -1,16 +1,6 @@
1
1
  module Delayed
2
2
  module Web
3
3
  class JobsController < Delayed::Web::ApplicationController
4
- def invoke
5
- if job.can_invoke?
6
- job.invoke!
7
- flash[:notice] = t(:notice, scope: 'delayed/web.flashes.jobs.invoked')
8
- else
9
- flash[:alert] = t(:alert, scope: 'delayed/web.flashes.jobs.invoked', status: job.status)
10
- end
11
- redirect_to jobs_path
12
- end
13
-
14
4
  def queue
15
5
  if job.can_queue?
16
6
  job.queue!
@@ -4,10 +4,6 @@ module Delayed
4
4
  def queue! now = Time.current
5
5
  update_attributes! run_at: now, failed_at: nil, last_error: nil
6
6
  end
7
-
8
- def invoke!
9
- invoke_job
10
- end
11
7
  end
12
8
  end
13
9
  end
@@ -12,16 +12,12 @@ module Delayed
12
12
  end
13
13
  end
14
14
 
15
- def can_invoke?
16
- status != 'executing'
17
- end
18
-
19
15
  def can_destroy?
20
16
  status != 'executing'
21
17
  end
22
18
 
23
19
  def can_queue?
24
- status != 'queued' and status != 'executing'
20
+ status != 'executing'
25
21
  end
26
22
  end
27
23
  end
@@ -31,10 +31,6 @@ module Delayed
31
31
  true
32
32
  end
33
33
 
34
- def invoke!
35
- true
36
- end
37
-
38
34
  def destroy
39
35
  self
40
36
  end
@@ -0,0 +1,24 @@
1
+ module Delayed
2
+ module Web
3
+ class Job::Mongoid
4
+
5
+ def self.find *args
6
+ decorate Delayed::Job.find(*args)
7
+ end
8
+
9
+ def self.all
10
+ jobs = Delayed::Job.order_by(created_at: 'desc').limit(100)
11
+ Enumerator.new do |enumerator|
12
+ jobs.each do |job|
13
+ enumerator.yield decorate(job)
14
+ end
15
+ end
16
+ end
17
+
18
+ def self.decorate job
19
+ ActiveRecordDecorator.new StatusDecorator.new(job)
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -4,12 +4,6 @@
4
4
  <h1><%= title %></h1>
5
5
  </div>
6
6
 
7
- Page last updated: <span id="lastUpdated"></span>
8
- <br>
9
- <a id="loadNow" href="#">Updated now</a>
10
- <br>
11
- <a id="startLoading" href="#">Start Loading</a>
12
- <a id="stopLoading" href="#">Stop Loading</a>
13
7
  <table class="table table-bordered">
14
8
  <thead>
15
9
  <tr>
@@ -19,10 +13,10 @@ Page last updated: <span id="lastUpdated"></span>
19
13
  <th>Run At</th>
20
14
  <th>Attempts</th>
21
15
  <th style="width: 190px;">Last Error</th>
22
- <th style="width: 150px;">Actions</th>
16
+ <th style="width: 115px;">Actions</th>
23
17
  </tr>
24
18
  </thead>
25
- <tbody id="jobRows">
19
+ <tbody>
26
20
  <% if jobs.any? %>
27
21
  <% jobs.each do |job| %>
28
22
  <tr>
@@ -37,9 +31,6 @@ Page last updated: <span id="lastUpdated"></span>
37
31
  <td><%= job.attempts %></td>
38
32
  <td><%= link_to_if job.last_error.present?, truncate(job.last_error), job_path(job) %></td>
39
33
  <td>
40
- <% if job.can_invoke? %>
41
- <%= button_to 'Invoke', invoke_job_path(job), method: :put, class: 'btn btn-mini', form_class: 'btn-rails pull-left' %>
42
- <% end %>
43
34
  <% if job.can_queue? %>
44
35
  <%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn btn-mini', form_class: 'btn-rails pull-left' %>
45
36
  <% end %>
@@ -5,11 +5,8 @@
5
5
  <%= link_to 'Jobs', jobs_path %> / <%= title %>
6
6
  </h1>
7
7
  <div class="btn-group">
8
- <% if job.can_invoke? %>
9
- <%= button_to 'Invoke', invoke_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails pull-left' %>
10
- <% end %>
11
8
  <% if job.can_queue? %>
12
- <%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails' %>
9
+ <%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails pull-left' %>
13
10
  <% end %>
14
11
  <% if job.can_destroy? %>
15
12
  <%= button_to 'Delete', job_path(job), method: :delete, class: 'btn btn-danger', form_class: 'btn-rails pull-right' %>
@@ -2,7 +2,6 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title><%= title %></title>
5
- <%= javascript_include_tag 'delayed/web/application' %>
6
5
  <%= stylesheet_link_tag 'delayed/web/application' %>
7
6
  </head>
8
7
  <body>
@@ -8,6 +8,3 @@ en:
8
8
  destroyed:
9
9
  alert: 'Job cannot be deleted because it is already %{status}'
10
10
  notice: 'Job destroyed'
11
- invoked:
12
- alert: 'Job cannot be invoked because it is already %{status}'
13
- notice: 'Job invoked'
data/config/routes.rb CHANGED
@@ -3,6 +3,5 @@ Delayed::Web::Engine.routes.draw do
3
3
 
4
4
  resources :jobs, only: [:destroy, :index, :show] do
5
5
  put :queue, on: :member
6
- put :invoke, on: :member
7
6
  end
8
7
  end
@@ -1,5 +1,5 @@
1
1
  module Delayed
2
2
  module Web
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -33,27 +33,13 @@ describe Delayed::Web::StatusDecorator do
33
33
  end
34
34
  end
35
35
 
36
- describe '#can_invoke?' do
37
- it 'is true when failed' do
38
- expect(failed_job.can_invoke?).to be_true
39
- end
40
-
41
- it 'is true when queued' do
42
- expect(queued_job.can_invoke?).to be_true
43
- end
44
-
45
- it 'is false when executing' do
46
- expect(executing_job.can_invoke?).to be_false
47
- end
48
- end
49
-
50
36
  describe '#can_queue?' do
51
37
  it 'is true when failed' do
52
38
  expect(failed_job.can_queue?).to be_true
53
39
  end
54
40
 
55
- it 'is false when queued' do
56
- expect(queued_job.can_queue?).to be_false
41
+ it 'is true when queued' do
42
+ expect(queued_job.can_queue?).to be_true
57
43
  end
58
44
 
59
45
  it 'is false when executing' do
File without changes
File without changes