job_boss 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/job_boss.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "job_boss"
7
- s.version = '0.4.1'
7
+ s.version = '0.4.2'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Brian Underwood"]
10
10
  s.email = ["ml+job_boss@semi-sentient.com"]
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
 
@@ -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: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
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-11-29 00:00:00 -05:00
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