job_boss 0.4.1 → 0.4.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/job_boss.gemspec +1 -1
- data/lib/job_boss/boss.rb +9 -0
- data/test/unit/job_test.rb +7 -0
- metadata +4 -4
data/job_boss.gemspec
CHANGED
data/lib/job_boss/boss.rb
CHANGED
@@ -20,6 +20,15 @@ module JobBoss
|
|
20
20
|
@@queuer ||= Queuer.new
|
21
21
|
end
|
22
22
|
|
23
|
+
# Used to queue jobs
|
24
|
+
# Usage:
|
25
|
+
# Boss.queue_path('math#in_prime?', 42)
|
26
|
+
def queue_path(path, *args)
|
27
|
+
controller, action = path.split('#')
|
28
|
+
|
29
|
+
queue.send(controller).send(action, *args)
|
30
|
+
end
|
31
|
+
|
23
32
|
def logger
|
24
33
|
@@config.log_path = resolve_path(@@config.log_path)
|
25
34
|
|
data/test/unit/job_test.rb
CHANGED
@@ -39,6 +39,13 @@ class DaemonTest < ActiveSupport::TestCase
|
|
39
39
|
assert_nil job.error
|
40
40
|
|
41
41
|
|
42
|
+
# Test `queue_path` method
|
43
|
+
job = JobBoss::Boss.queue_path('string#concatenate', 'test', 'of', 'concatenation')
|
44
|
+
JobBoss::Job.wait_for_jobs(job)
|
45
|
+
assert_equal 13, JobBoss::Job.completed.count
|
46
|
+
|
47
|
+
assert_equal ['testofconcatenation', 3], job.result
|
48
|
+
|
42
49
|
# Test cancelling of a job
|
43
50
|
job = JobBoss::Boss.queue.sleep.sleep_for(10)
|
44
51
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_boss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Underwood
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-02 00:00:00 -05:00
|
19
19
|
default_executable: job_boss
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|