resque-access_worker_from_job 0.2.2 → 0.2.3
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
require "resque/monkeypatches/job"
|
1
|
+
require 'resque/plugins/access_worker_from_job'
|
@@ -1,4 +1,17 @@
|
|
1
|
-
|
1
|
+
require 'resque' unless defined?(Resque)
|
2
|
+
|
3
|
+
module Resque # :nodoc:
|
4
|
+
# Resque-AccessWorkerFromJob plugin overrides the Resque::Job#args method to pass the worker along as the last argument.
|
5
|
+
class Job
|
6
|
+
# Overridden args appends the worker when returning the list of args represented in this job's payload.
|
7
|
+
def args
|
8
|
+
@payload['args'] + [worker]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Resque # :nodoc:
|
14
|
+
|
2
15
|
module Plugins # :nodoc:
|
3
16
|
# Adds a Resque plugin to allow jobs to access the worker running them via a cleverly-named +worker+
|
4
17
|
# instance variable. Purpose: this allows jobs to access shared sockets in the parent worker.
|
@@ -55,7 +68,7 @@ module Resque
|
|
55
68
|
if args.last.is_a?(::Resque::Worker)
|
56
69
|
self.worker = args.last
|
57
70
|
else
|
58
|
-
raise "
|
71
|
+
raise "Resque::Job#args has not been overriden to pass worker as last argument."
|
59
72
|
end
|
60
73
|
|
61
74
|
if required_worker_class && worker.class.name != required_worker_class
|
@@ -65,4 +78,4 @@ module Resque
|
|
65
78
|
|
66
79
|
end
|
67
80
|
end
|
68
|
-
end
|
81
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{resque-access_worker_from_job}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kali Donovan"]
|
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"init.rb",
|
27
27
|
"lib/resque-access_worker_from_job.rb",
|
28
|
-
"lib/resque/monkeypatches/job.rb",
|
29
28
|
"lib/resque/plugins/access_worker_from_job.rb",
|
30
29
|
"rails/init.rb",
|
31
30
|
"resque-access_worker_from_job.gemspec"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-access_worker_from_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kali Donovan
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- VERSION
|
41
41
|
- init.rb
|
42
42
|
- lib/resque-access_worker_from_job.rb
|
43
|
-
- lib/resque/monkeypatches/job.rb
|
44
43
|
- lib/resque/plugins/access_worker_from_job.rb
|
45
44
|
- rails/init.rb
|
46
45
|
- resque-access_worker_from_job.gemspec
|
@@ -1,10 +0,0 @@
|
|
1
|
-
module Resque # :nodoc:
|
2
|
-
# Resque-AccessWorkerFromJob plugin overrides the Resque::Job#args method to pass the worker along as the last argument.
|
3
|
-
class Job
|
4
|
-
# Overridden args appends the worker when returning the list of args represented in this job's payload.
|
5
|
-
def args
|
6
|
-
@payload['args'] + [worker]
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|