resque-mongo 1.8.1 → 1.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/test_helper'
3
3
  context "Resque::Job before_perform" do
4
4
  include PerformJob
5
5
 
6
- class BeforePerformJob
6
+ class ::BeforePerformJob
7
7
  def self.before_perform_record_history(history)
8
8
  history << :before_perform
9
9
  end
@@ -19,7 +19,7 @@ context "Resque::Job before_perform" do
19
19
  assert_equal history, [:before_perform, :perform]
20
20
  end
21
21
 
22
- class BeforePerformJobFails
22
+ class ::BeforePerformJobFails
23
23
  def self.before_perform_fail_job(history)
24
24
  history << :before_perform
25
25
  raise StandardError
@@ -37,7 +37,7 @@ context "Resque::Job before_perform" do
37
37
  assert_equal history, [:before_perform], "Only before_perform was run"
38
38
  end
39
39
 
40
- class BeforePerformJobAborts
40
+ class ::BeforePerformJobAborts
41
41
  def self.before_perform_abort(history)
42
42
  history << :before_perform
43
43
  raise Resque::Job::DontPerform
@@ -57,7 +57,7 @@ end
57
57
  context "Resque::Job after_perform" do
58
58
  include PerformJob
59
59
 
60
- class AfterPerformJob
60
+ class ::AfterPerformJob
61
61
  def self.perform(history)
62
62
  history << :perform
63
63
  end
@@ -72,7 +72,7 @@ context "Resque::Job after_perform" do
72
72
  assert_equal history, [:perform, :after_perform]
73
73
  end
74
74
 
75
- class AfterPerformJobFails
75
+ class ::AfterPerformJobFails
76
76
  def self.perform(history)
77
77
  history << :perform
78
78
  end
@@ -94,7 +94,7 @@ end
94
94
  context "Resque::Job around_perform" do
95
95
  include PerformJob
96
96
 
97
- class AroundPerformJob
97
+ class ::AroundPerformJob
98
98
  def self.perform(history)
99
99
  history << :perform
100
100
  end
@@ -111,7 +111,7 @@ context "Resque::Job around_perform" do
111
111
  assert_equal history, [:start_around_perform, :perform, :finish_around_perform]
112
112
  end
113
113
 
114
- class AroundPerformJobFailsBeforePerforming
114
+ class ::AroundPerformJobFailsBeforePerforming
115
115
  def self.perform(history)
116
116
  history << :perform
117
117
  end
@@ -131,7 +131,7 @@ context "Resque::Job around_perform" do
131
131
  assert_equal history, [:start_around_perform], "Only part of around_perform was run"
132
132
  end
133
133
 
134
- class AroundPerformJobFailsWhilePerforming
134
+ class ::AroundPerformJobFailsWhilePerforming
135
135
  def self.perform(history)
136
136
  history << :perform
137
137
  raise StandardError
@@ -155,7 +155,7 @@ context "Resque::Job around_perform" do
155
155
  assert_equal history, [:start_around_perform, :perform, :ensure_around_perform], "Only part of around_perform was run"
156
156
  end
157
157
 
158
- class AroundPerformJobDoesNotHaveToYield
158
+ class ::AroundPerformJobDoesNotHaveToYield
159
159
  def self.perform(history)
160
160
  history << :perform
161
161
  end
@@ -176,7 +176,7 @@ end
176
176
  context "Resque::Job on_failure" do
177
177
  include PerformJob
178
178
 
179
- class FailureJobThatDoesNotFail
179
+ class ::FailureJobThatDoesNotFail
180
180
  def self.perform(history)
181
181
  history << :perform
182
182
  end
@@ -191,7 +191,7 @@ context "Resque::Job on_failure" do
191
191
  assert_equal history, [:perform]
192
192
  end
193
193
 
194
- class FailureJobThatFails
194
+ class ::FailureJobThatFails
195
195
  def self.perform(history)
196
196
  history << :perform
197
197
  raise StandardError, "oh no"
@@ -209,7 +209,7 @@ context "Resque::Job on_failure" do
209
209
  assert_equal history, [:perform, "oh no"]
210
210
  end
211
211
 
212
- class FailureJobThatFailsBadly
212
+ class ::FailureJobThatFailsBadly
213
213
  def self.perform(history)
214
214
  history << :perform
215
215
  raise SyntaxError, "oh no"
@@ -231,7 +231,7 @@ end
231
231
  context "Resque::Job all hooks" do
232
232
  include PerformJob
233
233
 
234
- class VeryHookyJob
234
+ class ::VeryHookyJob
235
235
  def self.before_perform_record_history(history)
236
236
  history << :before_perform
237
237
  end
@@ -263,7 +263,7 @@ context "Resque::Job all hooks" do
263
263
  ]
264
264
  end
265
265
 
266
- class VeryHookyJobThatFails
266
+ class ::VeryHookyJobThatFails
267
267
  def self.before_perform_record_history(history)
268
268
  history << :before_perform
269
269
  end
@@ -21,7 +21,7 @@ context "Multiple plugins with multiple hooks" do
21
21
  end
22
22
  end
23
23
 
24
- class ManyBeforesJob
24
+ class ::ManyBeforesJob
25
25
  extend Plugin1
26
26
  extend Plugin2
27
27
  def self.perform(history)
@@ -45,7 +45,7 @@ context "Resque::Plugin ordering before_perform" do
45
45
  end
46
46
  end
47
47
 
48
- class BeforePerformJob
48
+ class ::BeforePerformJob
49
49
  extend BeforePerformPlugin
50
50
  def self.perform(history)
51
51
  history << :perform
@@ -71,7 +71,7 @@ context "Resque::Plugin ordering after_perform" do
71
71
  end
72
72
  end
73
73
 
74
- class AfterPerformJob
74
+ class ::AfterPerformJob
75
75
  extend AfterPerformPlugin
76
76
  def self.perform(history)
77
77
  history << :perform
@@ -98,7 +98,7 @@ context "Resque::Plugin ordering around_perform" do
98
98
  end
99
99
  end
100
100
 
101
- class AroundPerformJustPerformsJob
101
+ class ::AroundPerformJustPerformsJob
102
102
  extend AroundPerformPlugin1
103
103
  def self.perform(history)
104
104
  history << :perform
@@ -111,7 +111,7 @@ context "Resque::Plugin ordering around_perform" do
111
111
  assert_equal [:around_perform_plugin1, :perform], history
112
112
  end
113
113
 
114
- class AroundPerformJob
114
+ class ::AroundPerformJob
115
115
  extend AroundPerformPlugin1
116
116
  def self.perform(history)
117
117
  history << :perform
@@ -135,7 +135,7 @@ context "Resque::Plugin ordering around_perform" do
135
135
  end
136
136
  end
137
137
 
138
- class AroundPerformJob2
138
+ class ::AroundPerformJob2
139
139
  extend AroundPerformPlugin1
140
140
  extend AroundPerformPlugin2
141
141
  def self.perform(history)
@@ -159,7 +159,7 @@ context "Resque::Plugin ordering around_perform" do
159
159
  end
160
160
  end
161
161
 
162
- class AroundPerformJob3
162
+ class ::AroundPerformJob3
163
163
  extend AroundPerformPlugin1
164
164
  extend AroundPerformPlugin2
165
165
  extend AroundPerformDoesNotYield
@@ -177,6 +177,27 @@ context "Resque::Plugin ordering around_perform" do
177
177
  assert_equal false, result, "perform returned false"
178
178
  assert_equal [:around_perform, :around_perform0], history
179
179
  end
180
+
181
+ module AroundPerformGetsJobResult
182
+ @@result = nil
183
+ def last_job_result
184
+ @@result
185
+ end
186
+
187
+ def around_perform_gets_job_result(*args)
188
+ @@result = yield
189
+ end
190
+ end
191
+
192
+ class ::AroundPerformJobWithReturnValue < GoodJob
193
+ extend AroundPerformGetsJobResult
194
+ end
195
+
196
+ test "the job is aborted if an around_perform hook does not yield" do
197
+ result = perform_job(AroundPerformJobWithReturnValue, 'Bob')
198
+ assert_equal true, result, "perform returned true"
199
+ assert_equal 'Good job, Bob', AroundPerformJobWithReturnValue.last_job_result
200
+ end
180
201
  end
181
202
 
182
203
  context "Resque::Plugin ordering on_failure" do
@@ -188,7 +209,7 @@ context "Resque::Plugin ordering on_failure" do
188
209
  end
189
210
  end
190
211
 
191
- class FailureJob
212
+ class ::FailureJob
192
213
  extend OnFailurePlugin
193
214
  def self.perform(history)
194
215
  history << :perform
@@ -19,33 +19,33 @@ context "Resque::Plugin finding hooks" do
19
19
  end
20
20
 
21
21
  test "before_perform hooks are found and sorted" do
22
- assert_equal ["before_perform", "before_perform1", "before_perform2"], Resque::Plugin.before_hooks(SimplePlugin)
22
+ assert_equal ["before_perform", "before_perform1", "before_perform2"], Resque::Plugin.before_hooks(SimplePlugin).map {|m| m.to_s}
23
23
  end
24
24
 
25
25
  test "after_perform hooks are found and sorted" do
26
- assert_equal ["after_perform", "after_perform1", "after_perform2"], Resque::Plugin.after_hooks(SimplePlugin)
26
+ assert_equal ["after_perform", "after_perform1", "after_perform2"], Resque::Plugin.after_hooks(SimplePlugin).map {|m| m.to_s}
27
27
  end
28
28
 
29
29
  test "around_perform hooks are found and sorted" do
30
- assert_equal ["around_perform", "around_perform1", "around_perform2"], Resque::Plugin.around_hooks(SimplePlugin)
30
+ assert_equal ["around_perform", "around_perform1", "around_perform2"], Resque::Plugin.around_hooks(SimplePlugin).map {|m| m.to_s}
31
31
  end
32
32
 
33
33
  test "on_failure hooks are found and sorted" do
34
- assert_equal ["on_failure", "on_failure1", "on_failure2"], Resque::Plugin.failure_hooks(SimplePlugin)
34
+ assert_equal ["on_failure", "on_failure1", "on_failure2"], Resque::Plugin.failure_hooks(SimplePlugin).map {|m| m.to_s}
35
35
  end
36
36
  end
37
37
 
38
38
  context "Resque::Plugin linting" do
39
- module BadBefore
39
+ module ::BadBefore
40
40
  def self.before_perform; end
41
41
  end
42
- module BadAfter
42
+ module ::BadAfter
43
43
  def self.after_perform; end
44
44
  end
45
- module BadAround
45
+ module ::BadAround
46
46
  def self.around_perform; end
47
47
  end
48
- module BadFailure
48
+ module ::BadFailure
49
49
  def self.on_failure; end
50
50
  end
51
51
 
@@ -113,20 +113,3 @@ databases 16
113
113
  # single TCP packet. Uses a bit more CPU but most of the times it is a win
114
114
  # in terms of number of queries per second. Use 'yes' if unsure.
115
115
  glueoutputbuf yes
116
-
117
- # Use object sharing. Can save a lot of memory if you have many common
118
- # string in your dataset, but performs lookups against the shared objects
119
- # pool so it uses more CPU and can be a bit slower. Usually it's a good
120
- # idea.
121
- #
122
- # When object sharing is enabled (shareobjects yes) you can use
123
- # shareobjectspoolsize to control the size of the pool used in order to try
124
- # object sharing. A bigger pool size will lead to better sharing capabilities.
125
- # In general you want this value to be at least the double of the number of
126
- # very common strings you have in your dataset.
127
- #
128
- # WARNING: object sharing is experimental, don't enable this feature
129
- # in production before of Redis 1.0-stable. Still please try this feature in
130
- # your development environment so that we can test it better.
131
- shareobjects no
132
- shareobjectspoolsize 1024
@@ -32,23 +32,3 @@ context "on GET to /failed" do
32
32
 
33
33
  should_respond_with_success
34
34
  end
35
-
36
- # Stats
37
- context "on GET to /stats/resque" do
38
- setup { get "/stats/resque" }
39
-
40
- should_respond_with_success
41
- end
42
-
43
- context "on GET to /stats/redis" do
44
- setup { get "/stats/redis" }
45
-
46
- should_respond_with_success
47
- end
48
-
49
- context "on GET to /stats/resque" do
50
- setup { get "/stats/keys" }
51
-
52
- should_respond_with_success
53
- end
54
-
metadata CHANGED
@@ -4,9 +4,10 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 9
7
8
  - 8
8
9
  - 1
9
- version: 1.8.1
10
+ version: 1.9.8.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Christos Trochalakis
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-08 00:00:00 +03:00
18
+ date: 2010-07-27 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,9 +26,10 @@ dependencies:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
27
28
  segments:
29
+ - 1
30
+ - 0
28
31
  - 0
29
- - 20
30
- version: "0.20"
32
+ version: 1.0.0
31
33
  type: :runtime
32
34
  version_requirements: *id001
33
35
  - !ruby/object:Gem::Dependency
@@ -35,7 +37,7 @@ dependencies:
35
37
  prerelease: false
36
38
  requirement: &id002 !ruby/object:Gem::Requirement
37
39
  requirements:
38
- - - ">="
40
+ - - ~>
39
41
  - !ruby/object:Gem::Version
40
42
  segments:
41
43
  - 0
@@ -59,18 +61,20 @@ dependencies:
59
61
  type: :runtime
60
62
  version_requirements: *id003
61
63
  - !ruby/object:Gem::Dependency
62
- name: jeweler
64
+ name: json
63
65
  prerelease: false
64
66
  requirement: &id004 !ruby/object:Gem::Requirement
65
67
  requirements:
66
68
  - - ">="
67
69
  - !ruby/object:Gem::Version
68
70
  segments:
71
+ - 1
72
+ - 1
69
73
  - 0
70
- version: "0"
71
- type: :development
74
+ version: 1.1.0
75
+ type: :runtime
72
76
  version_requirements: *id004
73
- description: ""
77
+ description: " Resque-mongo is a fork of resque that uses mongo as a queue backend.\n\n Resque is a Redis-backed Ruby library for creating background jobs,\n placing those jobs on multiple queues, and processing them later.\n\n Background jobs can be any Ruby class or module that responds to\n perform. Your existing classes can easily be converted to background\n jobs or you can create new classes specifically to do work. Or, you\n can do both.\n\n Resque is heavily inspired by DelayedJob (which rocks) and is\n comprised of three parts:\n\n * A Ruby library for creating, querying, and processing jobs\n * A Rake task for starting a worker which processes jobs\n * A Sinatra app for monitoring queues, jobs, and workers.\n"
74
78
  email: yatiohi@ideopolis.gr
75
79
  executables:
76
80
  - resque
@@ -81,77 +85,59 @@ extra_rdoc_files:
81
85
  - LICENSE
82
86
  - README.markdown
83
87
  files:
84
- - .gitignore
85
- - .kick
86
- - CONTRIBUTORS
87
- - HISTORY.md
88
- - LICENSE
89
88
  - README.markdown
90
89
  - Rakefile
91
- - bin/resque
92
- - bin/resque-web
93
- - config.ru
94
- - deps.rip
95
- - docs/HOOKS.md
96
- - docs/PLUGINS.md
97
- - examples/async_helper.rb
98
- - examples/demo/README.markdown
99
- - examples/demo/Rakefile
100
- - examples/demo/app.rb
101
- - examples/demo/config.ru
102
- - examples/demo/job.rb
103
- - examples/god/resque.god
104
- - examples/god/stale.god
105
- - examples/instance.rb
106
- - examples/monit/resque.monit
107
- - examples/simple.rb
108
- - init.rb
109
- - lib/resque.rb
90
+ - LICENSE
91
+ - HISTORY.md
92
+ - lib/resque/worker.rb
93
+ - lib/resque/tasks.rb
110
94
  - lib/resque/errors.rb
95
+ - lib/resque/plugin.rb
96
+ - lib/resque/helpers.rb
111
97
  - lib/resque/failure.rb
98
+ - lib/resque/version.rb
112
99
  - lib/resque/failure/base.rb
113
100
  - lib/resque/failure/hoptoad.rb
114
- - lib/resque/failure/mongo.rb
115
101
  - lib/resque/failure/multiple.rb
116
- - lib/resque/helpers.rb
117
- - lib/resque/job.rb
118
- - lib/resque/plugin.rb
102
+ - lib/resque/failure/mongo.rb
103
+ - lib/resque/stat.rb
119
104
  - lib/resque/server.rb
120
- - lib/resque/server/public/idle.png
121
- - lib/resque/server/public/jquery-1.3.2.min.js
122
- - lib/resque/server/public/jquery.relatize_date.js
123
- - lib/resque/server/public/poll.png
105
+ - lib/resque/server/test_helper.rb
124
106
  - lib/resque/server/public/ranger.js
125
- - lib/resque/server/public/reset.css
126
107
  - lib/resque/server/public/style.css
108
+ - lib/resque/server/public/idle.png
127
109
  - lib/resque/server/public/working.png
128
- - lib/resque/server/test_helper.rb
129
- - lib/resque/server/views/error.erb
110
+ - lib/resque/server/public/poll.png
111
+ - lib/resque/server/public/jquery-1.3.2.min.js
112
+ - lib/resque/server/public/reset.css
113
+ - lib/resque/server/public/jquery.relatize_date.js
130
114
  - lib/resque/server/views/failed.erb
131
- - lib/resque/server/views/key_sets.erb
132
115
  - lib/resque/server/views/key_string.erb
116
+ - lib/resque/server/views/key_sets.erb
133
117
  - lib/resque/server/views/layout.erb
134
- - lib/resque/server/views/next_more.erb
135
- - lib/resque/server/views/overview.erb
136
118
  - lib/resque/server/views/queues.erb
137
119
  - lib/resque/server/views/stats.erb
138
120
  - lib/resque/server/views/workers.erb
121
+ - lib/resque/server/views/next_more.erb
122
+ - lib/resque/server/views/error.erb
123
+ - lib/resque/server/views/overview.erb
139
124
  - lib/resque/server/views/working.erb
140
- - lib/resque/stat.rb
141
- - lib/resque/tasks.rb
142
- - lib/resque/version.rb
143
- - lib/resque/worker.rb
144
- - tasks/redis.rake
145
- - tasks/resque.rake
146
- - test/dump.rdb
147
- - test/job_hooks_test.rb
125
+ - lib/resque/job.rb
126
+ - lib/resque.rb
127
+ - bin/resque
128
+ - bin/resque-web
129
+ - test/test_helper.rb
148
130
  - test/job_plugins_test.rb
131
+ - test/resque-web_test.rb
132
+ - test/job_hooks_test.rb
149
133
  - test/plugin_test.rb
134
+ - test/resque-mongo_benchmark.rb
150
135
  - test/redis-test.conf
151
- - test/resque-web_test.rb
152
- - test/resque_test.rb
153
- - test/test_helper.rb
154
136
  - test/worker_test.rb
137
+ - test/dump.rdb
138
+ - test/resque_test.rb
139
+ - tasks/redis.rake
140
+ - tasks/resque.rake
155
141
  has_rdoc: true
156
142
  homepage: http://github.com/ctrochalakis/resque-mongo
157
143
  licenses: []
@@ -181,18 +167,6 @@ rubyforge_project:
181
167
  rubygems_version: 1.3.6
182
168
  signing_key:
183
169
  specification_version: 3
184
- summary: ""
185
- test_files:
186
- - test/test_helper.rb
187
- - test/job_plugins_test.rb
188
- - test/resque-web_test.rb
189
- - test/job_hooks_test.rb
190
- - test/plugin_test.rb
191
- - test/resque-mongo_benchmark.rb
192
- - test/worker_test.rb
193
- - test/resque_test.rb
194
- - examples/demo/app.rb
195
- - examples/demo/job.rb
196
- - examples/simple.rb
197
- - examples/instance.rb
198
- - examples/async_helper.rb
170
+ summary: Resque-mongo is resque fork with a mongo backend.
171
+ test_files: []
172
+