navvy 0.3.1 → 0.3.2
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/LICENSE +3 -20
- data/README.textile +1 -5
- data/lib/navvy.rb +16 -3
- data/lib/navvy/job.rb +19 -19
- data/lib/navvy/job/active_record.rb +3 -3
- data/lib/navvy/job/data_mapper.rb +9 -14
- data/lib/navvy/job/mongo_mapper.rb +2 -2
- data/lib/navvy/job/mongoid.rb +3 -3
- data/lib/navvy/job/sequel.rb +17 -20
- data/lib/navvy/tasks.rb +4 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/job_spec.rb +34 -25
- data/spec/logger_spec.rb +1 -1
- data/spec/setup/active_record.rb +1 -1
- data/spec/setup/data_mapper.rb +2 -1
- data/spec/setup/mongo_mapper.rb +1 -1
- data/spec/setup/mongoid.rb +1 -1
- data/spec/setup/sequel.rb +1 -1
- data/spec/spec_helper.rb +10 -13
- data/spec/worker_spec.rb +1 -1
- metadata +92 -11
data/LICENSE
CHANGED
@@ -1,20 +1,3 @@
|
|
1
|
-
Copyright
|
2
|
-
|
3
|
-
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright 2010 Jeff Kreeftmeijer.
|
2
|
+
You may use this work without restrictions, as long as this notice is included.
|
3
|
+
The work is provided "as is" without warranty of any kind, neither express nor implied.
|
data/README.textile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
h1. Navvy
|
1
|
+
h1. Navvy "!http://stillmaintained.com/jeffkreeftmeijer/navvy.png!":http://stillmaintained.com/jeffkreeftmeijer/navvy
|
2
2
|
|
3
3
|
Navvy is a simple Ruby background job processor inspired by "delayed_job":http://github.com/tobi/delayed_job, but aiming for database agnosticism. Currently Navvy supports ActiveRecord, MongoMapper, Sequel, DataMapper and Mongoid but it's extremely easy to write an adapter for your favorite ORM.
|
4
4
|
|
@@ -13,7 +13,3 @@ Check out the "Installation Guide":http://wiki.github.com/jeffkreeftmeijer/navvy
|
|
13
13
|
h2. Contributing
|
14
14
|
|
15
15
|
Found an issue? Have a great idea? Want to help? Great! Create an issue "issue":http://github.com/jeffkreeftmeijer/navvy/issues for it, "ask":http://github.com/inbox/new/jeffkreeftmeijer, or even better; fork the project and fix the problem yourself. Pull requests are always welcome. :)
|
16
|
-
|
17
|
-
h2. License
|
18
|
-
|
19
|
-
Copyright (c) 2009 Jeff Kreeftmeijer, released under the MIT license
|
data/lib/navvy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'navvy/worker'
|
2
|
+
require 'navvy/logger'
|
3
|
+
require 'navvy/configuration'
|
4
4
|
|
5
5
|
module Navvy
|
6
6
|
class << self
|
@@ -19,3 +19,16 @@ module Navvy
|
|
19
19
|
yield(self.configuration)
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
|
24
|
+
if defined?(Rails)
|
25
|
+
|
26
|
+
module Navvy
|
27
|
+
class Railtie < Rails::Railtie
|
28
|
+
rake_tasks do
|
29
|
+
require 'navvy/tasks.rb'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/navvy/job.rb
CHANGED
@@ -64,8 +64,8 @@ module Navvy
|
|
64
64
|
def run
|
65
65
|
begin
|
66
66
|
started
|
67
|
-
result = constantize(object).send(method_name, *args)
|
68
|
-
Navvy::Job.keep? ? completed : destroy
|
67
|
+
result = constantize(object).send(method_name, *args).inspect
|
68
|
+
Navvy::Job.keep? ? completed(result) : destroy
|
69
69
|
result
|
70
70
|
rescue Exception => exception
|
71
71
|
failed(exception.message)
|
@@ -153,21 +153,21 @@ module Navvy
|
|
153
153
|
alias_method :completed?, :completed_at?
|
154
154
|
alias_method :failed?, :failed_at?
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
156
|
+
private
|
157
|
+
|
158
|
+
##
|
159
|
+
# Turn a constant with potential namespacing into an object
|
160
|
+
#
|
161
|
+
# @return [Class] class
|
162
|
+
|
163
|
+
def constantize(str)
|
164
|
+
names = str.split('::')
|
165
|
+
names.shift if names.empty? || names.first.empty?
|
166
|
+
constant = Object
|
167
|
+
names.each do |name|
|
168
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
169
|
+
end
|
170
|
+
constant
|
171
|
+
end
|
172
172
|
end
|
173
|
-
end
|
173
|
+
end
|
@@ -10,7 +10,7 @@ module Navvy
|
|
10
10
|
# @param [Symbol, String] method_name the name of the method you want to run
|
11
11
|
# @param [*] arguments optional arguments you want to pass to the method
|
12
12
|
#
|
13
|
-
# @return [
|
13
|
+
# @return [Job, false] created Job or false if failed
|
14
14
|
|
15
15
|
def self.enqueue(object, method_name, *args)
|
16
16
|
options = {}
|
@@ -22,7 +22,7 @@ module Navvy
|
|
22
22
|
create(
|
23
23
|
:object => object.to_s,
|
24
24
|
:method_name => method_name.to_s,
|
25
|
-
:arguments => args,
|
25
|
+
:arguments => args.to_yaml,
|
26
26
|
:priority => options[:priority] || 0,
|
27
27
|
:parent_id => options[:parent_id],
|
28
28
|
:run_at => options[:run_at] || Time.now,
|
@@ -133,4 +133,4 @@ module Navvy
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
require
|
136
|
+
require 'navvy/job'
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'dm-core'
|
2
|
+
require 'dm-migrations'
|
2
3
|
|
3
4
|
module Navvy
|
4
5
|
class Job
|
@@ -26,7 +27,7 @@ module Navvy
|
|
26
27
|
# run
|
27
28
|
# @param [*] arguments optional arguments you want to pass to the method
|
28
29
|
#
|
29
|
-
# @return [
|
30
|
+
# @return [Job, false] created Job or false if failed
|
30
31
|
|
31
32
|
def self.enqueue(object, method_name, *args)
|
32
33
|
options = {}
|
@@ -35,8 +36,7 @@ module Navvy
|
|
35
36
|
args.pop if args.last.empty?
|
36
37
|
end
|
37
38
|
|
38
|
-
new_job =
|
39
|
-
new_job.attributes = {
|
39
|
+
new_job = Job.create(
|
40
40
|
:object => object.to_s,
|
41
41
|
:method_name => method_name.to_s,
|
42
42
|
:arguments => args.to_yaml,
|
@@ -44,9 +44,7 @@ module Navvy
|
|
44
44
|
:parent_id => options[:parent_id],
|
45
45
|
:run_at => options[:run_at] || Time.now,
|
46
46
|
:created_at => Time.now
|
47
|
-
|
48
|
-
new_job.save
|
49
|
-
new_job
|
47
|
+
)
|
50
48
|
end
|
51
49
|
|
52
50
|
##
|
@@ -91,7 +89,7 @@ module Navvy
|
|
91
89
|
# @return [true, false] deleted?
|
92
90
|
|
93
91
|
def self.delete_all
|
94
|
-
Navvy::Job.
|
92
|
+
Navvy::Job.destroy
|
95
93
|
end
|
96
94
|
|
97
95
|
##
|
@@ -101,9 +99,7 @@ module Navvy
|
|
101
99
|
# update_attributes call
|
102
100
|
|
103
101
|
def started
|
104
|
-
update(
|
105
|
-
:started_at => Time.now
|
106
|
-
})
|
102
|
+
update(:started_at => Time.now)
|
107
103
|
end
|
108
104
|
|
109
105
|
##
|
@@ -149,11 +145,10 @@ module Navvy
|
|
149
145
|
|
150
146
|
def times_failed
|
151
147
|
i = parent_id || id
|
152
|
-
self.class
|
153
|
-
|
154
|
-
).count
|
148
|
+
klass = self.class
|
149
|
+
(klass.all(:failed_at.not => nil) & (klass.all(:id => i) | klass.all(:parent_id => i))).count
|
155
150
|
end
|
156
151
|
end
|
157
152
|
end
|
158
153
|
|
159
|
-
require
|
154
|
+
require 'navvy/job'
|
@@ -25,7 +25,7 @@ module Navvy
|
|
25
25
|
# run
|
26
26
|
# @param [*] arguments optional arguments you want to pass to the method
|
27
27
|
#
|
28
|
-
# @return [
|
28
|
+
# @return [Job, false] created Job or false if failed
|
29
29
|
|
30
30
|
def self.enqueue(object, method_name, *args)
|
31
31
|
options = {}
|
@@ -147,4 +147,4 @@ module Navvy
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
require
|
150
|
+
require 'navvy/job'
|
data/lib/navvy/job/mongoid.rb
CHANGED
@@ -11,7 +11,7 @@ module Navvy
|
|
11
11
|
field :priority, :type => Integer, :default => 0
|
12
12
|
field :return, :type => String
|
13
13
|
field :exception, :type => String
|
14
|
-
field :parent_id, :type =>
|
14
|
+
field :parent_id, :type => BSON::ObjectId
|
15
15
|
field :created_at, :type => Time
|
16
16
|
field :run_at, :type => Time
|
17
17
|
field :started_at, :type => Time
|
@@ -29,7 +29,7 @@ module Navvy
|
|
29
29
|
# run
|
30
30
|
# @param [*] arguments optional arguments you want to pass to the method
|
31
31
|
#
|
32
|
-
# @return [
|
32
|
+
# @return [Job, false] created Job or false if failed
|
33
33
|
|
34
34
|
def self.enqueue(object, method_name, *args)
|
35
35
|
options = {}
|
@@ -136,4 +136,4 @@ module Navvy
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
require
|
139
|
+
require 'navvy/job'
|
data/lib/navvy/job/sequel.rb
CHANGED
@@ -12,7 +12,7 @@ module Navvy
|
|
12
12
|
# run
|
13
13
|
# @param [*] arguments optional arguments you want to pass to the method
|
14
14
|
#
|
15
|
-
# @return [
|
15
|
+
# @return [Job, false] created Job or false if failed
|
16
16
|
|
17
17
|
def self.enqueue(object, method_name, *args)
|
18
18
|
options = {}
|
@@ -21,7 +21,7 @@ module Navvy
|
|
21
21
|
args.pop if args.last.empty?
|
22
22
|
end
|
23
23
|
|
24
|
-
insert(
|
24
|
+
Job[insert(
|
25
25
|
:object => object.to_s,
|
26
26
|
:method_name => method_name.to_s,
|
27
27
|
:arguments => args.to_yaml,
|
@@ -29,8 +29,7 @@ module Navvy
|
|
29
29
|
:parent_id => options[:parent_id],
|
30
30
|
:run_at => options[:run_at] || Time.now,
|
31
31
|
:created_at => Time.now
|
32
|
-
)
|
33
|
-
order(:id.desc).first
|
32
|
+
)]
|
34
33
|
end
|
35
34
|
|
36
35
|
##
|
@@ -45,11 +44,11 @@ module Navvy
|
|
45
44
|
# jobs were found.
|
46
45
|
|
47
46
|
def self.next(limit = self.limit)
|
48
|
-
filter(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
filter(:failed_at => nil).
|
48
|
+
filter(:completed_at => nil).
|
49
|
+
filter{run_at <= Time.now}.
|
50
|
+
order(:priority.desc, :created_at).
|
51
|
+
first(limit)
|
53
52
|
end
|
54
53
|
|
55
54
|
##
|
@@ -61,7 +60,8 @@ module Navvy
|
|
61
60
|
|
62
61
|
def self.cleanup
|
63
62
|
if keep.is_a? Fixnum
|
64
|
-
|
63
|
+
time = Time.now - keep
|
64
|
+
filter{completed_at <= time}.delete
|
65
65
|
else
|
66
66
|
filter(~{:completed_at => nil}).delete unless keep?
|
67
67
|
end
|
@@ -76,7 +76,6 @@ module Navvy
|
|
76
76
|
Navvy::Job.destroy
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
79
|
##
|
81
80
|
# Mark the job as started. Will set started_at to the current time.
|
82
81
|
#
|
@@ -84,9 +83,7 @@ module Navvy
|
|
84
83
|
# update_attributes call
|
85
84
|
|
86
85
|
def started
|
87
|
-
update(
|
88
|
-
:started_at => Time.now
|
89
|
-
})
|
86
|
+
update(:started_at => Time.now)
|
90
87
|
end
|
91
88
|
|
92
89
|
##
|
@@ -99,10 +96,10 @@ module Navvy
|
|
99
96
|
# update_attributes call
|
100
97
|
|
101
98
|
def completed(return_value = nil)
|
102
|
-
update(
|
99
|
+
update(
|
103
100
|
:completed_at => Time.now,
|
104
101
|
:return => return_value
|
105
|
-
|
102
|
+
)
|
106
103
|
end
|
107
104
|
|
108
105
|
##
|
@@ -131,11 +128,11 @@ module Navvy
|
|
131
128
|
|
132
129
|
def times_failed
|
133
130
|
i = parent_id || id
|
134
|
-
self.class.filter(
|
135
|
-
(
|
136
|
-
|
131
|
+
self.class.filter({:id => i} | {:parent_id => i}).
|
132
|
+
filter(~{:failed_at => nil}).
|
133
|
+
count
|
137
134
|
end
|
138
135
|
end
|
139
136
|
end
|
140
137
|
|
141
|
-
require
|
138
|
+
require 'navvy/job'
|
data/lib/navvy/tasks.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
data/spec/job_spec.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Navvy::Job' do
|
4
|
+
before do
|
5
|
+
Timecop.freeze(Time.local(2010, 1, 1))
|
6
|
+
end
|
7
|
+
|
8
|
+
after do
|
9
|
+
Timecop.return
|
10
|
+
end
|
11
|
+
|
4
12
|
describe '.keep?' do
|
5
13
|
after(:each) do
|
6
14
|
Navvy::Job.keep = false
|
@@ -70,17 +78,14 @@ describe 'Navvy::Job' do
|
|
70
78
|
it 'should set the created_at date' do
|
71
79
|
Navvy::Job.enqueue(Cow, :speak, true, false)
|
72
80
|
job = first_job
|
73
|
-
job.created_at.should
|
74
|
-
job.created_at.should <= Time.now
|
75
|
-
job.created_at.should > Time.now - 10
|
81
|
+
job.created_at.should == Time.now
|
76
82
|
end
|
77
83
|
|
78
84
|
it 'should set the run_at date' do
|
79
85
|
Navvy::Job.enqueue(Cow, :speak, true, false)
|
80
86
|
job = first_job
|
81
|
-
job.run_at.should
|
82
|
-
job.
|
83
|
-
job.created_at.should > Time.now - 10
|
87
|
+
job.run_at.should == Time.now
|
88
|
+
job.created_at.should == Time.now
|
84
89
|
end
|
85
90
|
|
86
91
|
it 'should return the enqueued job' do
|
@@ -201,27 +206,34 @@ describe 'Navvy::Job' do
|
|
201
206
|
|
202
207
|
it 'should run the job and delete it' do
|
203
208
|
jobs = Navvy::Job.next
|
204
|
-
jobs.first.run.should == 'moo'
|
209
|
+
jobs.first.run.should == '"moo"'
|
205
210
|
job_count.should == 0
|
206
211
|
end
|
207
212
|
|
208
213
|
describe 'when Navvy::Job.keep is set' do
|
214
|
+
it 'should call #completed with the return value after processing the job' do
|
215
|
+
Navvy::Job.keep = true
|
216
|
+
jobs = Navvy::Job.next
|
217
|
+
jobs.first.should_receive(:completed).with('"moo"')
|
218
|
+
jobs.first.run
|
219
|
+
end
|
220
|
+
|
209
221
|
it 'should mark the job as complete when keep is true' do
|
210
222
|
Navvy::Job.keep = true
|
211
223
|
jobs = Navvy::Job.next
|
212
224
|
jobs.first.run
|
213
225
|
job_count.should == 1
|
214
|
-
jobs.first.started_at.should
|
215
|
-
jobs.first.completed_at.should
|
226
|
+
jobs.first.started_at.should == Time.now
|
227
|
+
jobs.first.completed_at.should == Time.now
|
216
228
|
end
|
217
229
|
|
218
|
-
it 'should mark the job as complete when keep has not passed
|
230
|
+
it 'should mark the job as complete when keep has not passed yet' do
|
219
231
|
Navvy::Job.keep = (60 * 60)
|
220
232
|
jobs = Navvy::Job.next
|
221
233
|
jobs.first.run
|
222
234
|
job_count.should == 1
|
223
|
-
jobs.first.started_at.should
|
224
|
-
jobs.first.completed_at.should
|
235
|
+
jobs.first.started_at.should == Time.now
|
236
|
+
jobs.first.completed_at.should == Time.now
|
225
237
|
end
|
226
238
|
|
227
239
|
it 'should delete the job when the "keep" flag has passed' do
|
@@ -243,8 +255,8 @@ describe 'Navvy::Job' do
|
|
243
255
|
jobs = Navvy::Job.next
|
244
256
|
jobs.first.run
|
245
257
|
jobs.first.exception.should == 'this method is broken'
|
246
|
-
jobs.first.started_at.should
|
247
|
-
jobs.first.failed_at.should
|
258
|
+
jobs.first.started_at.should == Time.now
|
259
|
+
jobs.first.failed_at.should == Time.now
|
248
260
|
end
|
249
261
|
end
|
250
262
|
end
|
@@ -358,25 +370,22 @@ describe 'Navvy::Job' do
|
|
358
370
|
it 'should set the run_at date to about 16 seconds from now' do
|
359
371
|
failed_job = Navvy::Job.enqueue(Cow, :speak, 'name' => 'Betsy')
|
360
372
|
failed_job.stub!(:times_failed).and_return 2
|
361
|
-
now = Time.now
|
362
373
|
job = failed_job.retry
|
363
|
-
job.run_at.to_i.should == (now + 16).to_i
|
374
|
+
job.run_at.to_i.should == (Time.now + 16).to_i
|
364
375
|
end
|
365
376
|
|
366
377
|
it 'should set the run_at date to about 256 seconds from now' do
|
367
378
|
failed_job = Navvy::Job.enqueue(Cow, :speak, 'name' => 'Betsy')
|
368
379
|
failed_job.stub!(:times_failed).and_return 4
|
369
|
-
now = Time.now
|
370
380
|
job = failed_job.retry
|
371
|
-
job.run_at.to_i.should == (now + 256).to_i
|
381
|
+
job.run_at.to_i.should == (Time.now + 256).to_i
|
372
382
|
end
|
373
383
|
|
374
384
|
it 'should set the run_at date to about 4096 seconds from now' do
|
375
385
|
failed_job = Navvy::Job.enqueue(Cow, :speak, 'name' => 'Betsy')
|
376
386
|
failed_job.stub!(:times_failed).and_return 8
|
377
|
-
now = Time.now
|
378
387
|
job = failed_job.retry
|
379
|
-
job.run_at.to_i.should == (now + 4096).to_i
|
388
|
+
job.run_at.to_i.should == (Time.now + 4096).to_i
|
380
389
|
end
|
381
390
|
|
382
391
|
it 'should set the parent_id to the master job id' do
|
@@ -458,7 +467,7 @@ describe 'Navvy::Job' do
|
|
458
467
|
:completed_at => Time.now
|
459
468
|
)
|
460
469
|
|
461
|
-
job.duration.should
|
470
|
+
job.duration.should == 2
|
462
471
|
end
|
463
472
|
|
464
473
|
it 'should return a duration if started_at and failed_at are set' do
|
@@ -467,7 +476,7 @@ describe 'Navvy::Job' do
|
|
467
476
|
:failed_at => Time.now
|
468
477
|
)
|
469
478
|
|
470
|
-
job.duration.should
|
479
|
+
job.duration.should == 3
|
471
480
|
end
|
472
481
|
|
473
482
|
it 'should return 0 if only started_at is set' do
|
@@ -488,9 +497,9 @@ describe 'Navvy::Job' do
|
|
488
497
|
end
|
489
498
|
|
490
499
|
describe '#namespaced' do
|
491
|
-
|
500
|
+
it 'should accept a namespaced class name' do
|
492
501
|
job = Navvy::Job.enqueue(Animals::Cow, :speak)
|
493
|
-
job.run.should == 'moo'
|
502
|
+
job.run.should == '"moo"'
|
494
503
|
end
|
495
504
|
end
|
496
505
|
end
|
data/spec/logger_spec.rb
CHANGED
data/spec/setup/active_record.rb
CHANGED
data/spec/setup/data_mapper.rb
CHANGED
data/spec/setup/mongo_mapper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'navvy/job/mongo_mapper'
|
2
2
|
MongoMapper.database = 'navvy_test'
|
data/spec/setup/mongoid.rb
CHANGED
data/spec/setup/sequel.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'navvy'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
Spec::Runner.configure do |config|
|
8
|
-
end
|
4
|
+
require 'rspec'
|
5
|
+
require 'timecop'
|
9
6
|
|
10
7
|
def job_count
|
11
8
|
if defined? Navvy::Job.count
|
@@ -30,13 +27,13 @@ class Cow
|
|
30
27
|
end
|
31
28
|
|
32
29
|
module Animals
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
class Cow
|
31
|
+
def self.speak
|
32
|
+
'moo'
|
33
|
+
end
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
def self.broken
|
36
|
+
raise 'this method is broken'
|
37
|
+
end
|
38
|
+
end
|
42
39
|
end
|
data/spec/worker_spec.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navvy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jeff Kreeftmeijer
|
@@ -14,37 +15,113 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-02 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: rake
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
|
-
-
|
29
|
-
|
30
|
-
- 9
|
31
|
-
version: 1.2.9
|
31
|
+
- 0
|
32
|
+
version: "0"
|
32
33
|
type: :development
|
33
34
|
version_requirements: *id001
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
36
|
+
name: sqlite3-ruby
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: bson_ext
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
38
54
|
requirements:
|
39
55
|
- - ">="
|
40
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rspec
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 2
|
74
|
+
- 0
|
75
|
+
version: "2.0"
|
76
|
+
type: :development
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: yard
|
80
|
+
prerelease: false
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 15
|
41
87
|
segments:
|
42
88
|
- 0
|
43
89
|
- 5
|
44
90
|
- 2
|
45
91
|
version: 0.5.2
|
46
92
|
type: :development
|
47
|
-
version_requirements: *
|
93
|
+
version_requirements: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: timecop
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 25
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
- 3
|
106
|
+
- 5
|
107
|
+
version: 0.3.5
|
108
|
+
type: :development
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: fuubar
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 11
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
- 0
|
122
|
+
version: "0.0"
|
123
|
+
type: :development
|
124
|
+
version_requirements: *id007
|
48
125
|
description: Simple background job processor inspired by delayed_job, but aiming for database agnosticism.
|
49
126
|
email: jeff@kreeftmeijer.nl
|
50
127
|
executables: []
|
@@ -91,23 +168,27 @@ rdoc_options: []
|
|
91
168
|
require_paths:
|
92
169
|
- lib
|
93
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
94
172
|
requirements:
|
95
173
|
- - ">="
|
96
174
|
- !ruby/object:Gem::Version
|
175
|
+
hash: 3
|
97
176
|
segments:
|
98
177
|
- 0
|
99
178
|
version: "0"
|
100
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
101
181
|
requirements:
|
102
182
|
- - ">="
|
103
183
|
- !ruby/object:Gem::Version
|
184
|
+
hash: 3
|
104
185
|
segments:
|
105
186
|
- 0
|
106
187
|
version: "0"
|
107
188
|
requirements: []
|
108
189
|
|
109
190
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.3.
|
191
|
+
rubygems_version: 1.3.7
|
111
192
|
signing_key:
|
112
193
|
specification_version: 3
|
113
194
|
summary: Simple background job processor inspired by delayed_job, but aiming for database agnosticism.
|