resque-hijacker 0.0.1

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 ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) Donald Plummer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
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.
data/README.md ADDED
@@ -0,0 +1,9 @@
1
+ Resque Hijacker
2
+ ===========
3
+
4
+ A [Resque][rq] plugin. Requires Resque 1.19.0.
5
+
6
+ If you are using the Hijacker plugin, use this to hijack to the correct
7
+ client database.
8
+
9
+ [rq]: http://github.com/defunkt/resque
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/resque/job.rb ADDED
@@ -0,0 +1,30 @@
1
+ module Resque
2
+ class Job
3
+ class << self
4
+ def create(queue, klass, *args)
5
+ Resque.validate(klass, queue)
6
+
7
+ if Resque.inline?
8
+ constantize(klass).perform(*decode(encode(args)))
9
+ else
10
+ Resque.push(queue, :class => klass.to_s,
11
+ :args => args,
12
+ :database => Hijacker.current_client)
13
+ end
14
+ end
15
+ end
16
+
17
+ alias_method :perform_without_hijacking, :perform
18
+ def perform
19
+ if database.present?
20
+ Hijacker.connect_to_master database
21
+ end
22
+
23
+ perform_without_hijacking
24
+ end
25
+
26
+ def database
27
+ @payload['database']
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ module Resque
2
+ module Plugins
3
+ module Hijacker
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module Resque
2
+ module Plugins
3
+ module Hijacker
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ require "resque"
2
+ require File.join(File.dirname(__FILE__), 'resque', 'plugins', 'hijacker')
3
+ require File.join(File.dirname(__FILE__), 'resque', 'plugins', 'hijacker', 'version')
4
+ require File.join(File.dirname(__FILE__), 'resque', 'job')
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: resque-hijacker
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Donald Plummer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-20 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :development
23
+ name: bundler
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 2
34
+ version: 1.0.2
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ hash: 31
38
+ segments:
39
+ - 1
40
+ - 2
41
+ - 0
42
+ version: 1.2.0
43
+ prerelease: false
44
+ requirement: *id001
45
+ - !ruby/object:Gem::Dependency
46
+ type: :development
47
+ name: rspec
48
+ version_requirements: &id002 !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ hash: 27
54
+ segments:
55
+ - 1
56
+ - 3
57
+ - 0
58
+ version: 1.3.0
59
+ prerelease: false
60
+ requirement: *id002
61
+ - !ruby/object:Gem::Dependency
62
+ type: :runtime
63
+ name: redis
64
+ version_requirements: &id003 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ hash: 7
70
+ segments:
71
+ - 2
72
+ - 2
73
+ - 0
74
+ version: 2.2.0
75
+ prerelease: false
76
+ requirement: *id003
77
+ - !ruby/object:Gem::Dependency
78
+ type: :runtime
79
+ name: resque
80
+ version_requirements: &id004 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 95
86
+ segments:
87
+ - 1
88
+ - 18
89
+ - 0
90
+ version: 1.18.0
91
+ - - <
92
+ - !ruby/object:Gem::Version
93
+ hash: 71
94
+ segments:
95
+ - 1
96
+ - 20
97
+ - 0
98
+ version: 1.20.0
99
+ prerelease: false
100
+ requirement: *id004
101
+ description: For use with the Hijacker plugin for multiple databases.
102
+ email:
103
+ - donald@crystalcommerce.com
104
+ executables: []
105
+
106
+ extensions: []
107
+
108
+ extra_rdoc_files: []
109
+
110
+ files:
111
+ - README.md
112
+ - Rakefile
113
+ - LICENSE
114
+ - lib/resque-hijacker.rb
115
+ - lib/resque/plugins/hijacker.rb
116
+ - lib/resque/plugins/hijacker/version.rb
117
+ - lib/resque/job.rb
118
+ has_rdoc: true
119
+ homepage: https://github.com/crystalcommerce/resque-hijacker
120
+ licenses: []
121
+
122
+ post_install_message:
123
+ rdoc_options: []
124
+
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ requirements: []
146
+
147
+ rubyforge_project: resque-hijacker
148
+ rubygems_version: 1.5.0
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Resque workers use Hijacker
152
+ test_files: []
153
+