resque-remote 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/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +44 -0
- data/Rakefile +2 -0
- data/lib/resque-remote.rb +2 -0
- data/lib/resque-remote/remote.rb +17 -0
- data/lib/resque-remote/version.rb +7 -0
- data/resque-remote.gemspec +39 -0
- data/spec/remote_spec.rb +40 -0
- data/spec/spec_helper.rb +7 -0
- metadata +172 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
resque-remote (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.1.2)
|
10
|
+
json (1.4.6)
|
11
|
+
rack (1.2.1)
|
12
|
+
redis (2.0.5)
|
13
|
+
redis-namespace (0.8.0)
|
14
|
+
redis (< 3.0.0)
|
15
|
+
resque (1.10.0)
|
16
|
+
json (~> 1.4.6)
|
17
|
+
redis-namespace (~> 0.8.0)
|
18
|
+
sinatra (>= 0.9.2)
|
19
|
+
vegas (~> 0.1.2)
|
20
|
+
rspec (2.0.0.beta.20)
|
21
|
+
rspec-core (= 2.0.0.beta.20)
|
22
|
+
rspec-expectations (= 2.0.0.beta.20)
|
23
|
+
rspec-mocks (= 2.0.0.beta.20)
|
24
|
+
rspec-core (2.0.0.beta.20)
|
25
|
+
rspec-expectations (2.0.0.beta.20)
|
26
|
+
diff-lcs (>= 1.1.2)
|
27
|
+
rspec-mocks (2.0.0.beta.20)
|
28
|
+
sinatra (1.0)
|
29
|
+
rack (>= 1.0)
|
30
|
+
vegas (0.1.7)
|
31
|
+
rack (>= 1.0.0)
|
32
|
+
yajl-ruby (0.7.7)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
bundler (= 1.0.0.rc.6)
|
39
|
+
redis
|
40
|
+
redis-namespace
|
41
|
+
resque (= 1.10.0)
|
42
|
+
resque-remote!
|
43
|
+
rspec (= 2.0.0.beta.20)
|
44
|
+
yajl-ruby
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Resque
|
2
|
+
module Plugins
|
3
|
+
module Remote
|
4
|
+
|
5
|
+
def remote_enqueue(klass, queue, *args)
|
6
|
+
Resque::Job.create(queue.to_sym, klass, *args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def remote_dequeue(klass, queue, *args)
|
10
|
+
Resque::Job.destroy(queue.to_sym, klass, *args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Pull the remote methods into the Resque module
|
16
|
+
extend Plugins::Remote
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/resque-remote/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'resque-remote'
|
6
|
+
s.version = Resque::Plugins::Remote::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['BJ Neilsen']
|
9
|
+
s.email = ['bj.neilsen@gmail.com']
|
10
|
+
s.homepage = 'http://github.com/localshred/resque-remote'
|
11
|
+
s.summary = 'Resque plugin to allow remote job droppability'
|
12
|
+
s.description = %Q{
|
13
|
+
Resque is great. So is job processing with redis. Our biggest drawback has been that
|
14
|
+
resque requires the class that will be processing a job to be loaded when the job
|
15
|
+
is enqueued. But what happens when the implementing job is defined in a separate application
|
16
|
+
and isn't currently loaded into memory?
|
17
|
+
|
18
|
+
Enter Resque Remote.
|
19
|
+
|
20
|
+
Resque Remote's simple goal is to allow you to add a job to a queue with a string
|
21
|
+
identifier for the class rather than the class constant. It is assumed that the worker-side of
|
22
|
+
the equation _will_ have the class in memory and hence will be able to run it no problem.
|
23
|
+
|
24
|
+
Feedback, comments and questions are welcome at bj [dot] neilsen [at] gmail [dot] com.
|
25
|
+
}
|
26
|
+
|
27
|
+
s.required_rubygems_version = '>= 1.3.6'
|
28
|
+
s.rubyforge_project = 'resque-remote'
|
29
|
+
|
30
|
+
s.add_development_dependency 'bundler', '1.0.0.rc.6'
|
31
|
+
s.add_development_dependency 'rspec', '2.0.0.beta.20'
|
32
|
+
s.add_development_dependency 'resque', '1.10.0'
|
33
|
+
s.add_development_dependency 'redis'
|
34
|
+
s.add_development_dependency 'redis-namespace'
|
35
|
+
s.add_development_dependency 'yajl-ruby'
|
36
|
+
|
37
|
+
s.files = `git ls-files`.split("\n")
|
38
|
+
s.require_path = 'lib'
|
39
|
+
end
|
data/spec/remote_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Resque::Plugins::Remote do
|
4
|
+
|
5
|
+
let(:queue_name) { :critical }
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
Resque.remove_queue(queue_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should pass resque lint" do
|
12
|
+
lambda {
|
13
|
+
Resque::Plugin.lint(Resque::Plugins::Remote)
|
14
|
+
}.should_not raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should respond to remote_enqueue" do
|
18
|
+
Resque.should respond_to :remote_enqueue
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should respond to remote_dequeue" do
|
22
|
+
Resque.should respond_to :remote_dequeue
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be able to queue a job with a string as the class name" do
|
26
|
+
lambda {
|
27
|
+
Resque.remote_enqueue('MyJobClass', queue_name, :param1, :param2)
|
28
|
+
}.should change{ Resque.size(queue_name) }.from(0).to(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to pull a job off of a queue" do
|
32
|
+
Resque.remote_enqueue('MyJobClass', queue_name, :param1, :param2)
|
33
|
+
Resque.size(queue_name).should == 1
|
34
|
+
|
35
|
+
lambda {
|
36
|
+
Resque.remote_dequeue('MyJobClass', queue_name, :param1, :param2)
|
37
|
+
}.should change{ Resque.size(queue_name) }.from(1).to(0)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque-remote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- BJ Neilsen
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-25 00:00:00 -06:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: bundler
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- rc
|
33
|
+
- 6
|
34
|
+
version: 1.0.0.rc.6
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
- beta
|
50
|
+
- 20
|
51
|
+
version: 2.0.0.beta.20
|
52
|
+
type: :development
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: resque
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - "="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 10
|
65
|
+
- 0
|
66
|
+
version: 1.10.0
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: redis
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: redis-namespace
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
type: :development
|
94
|
+
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: yajl-ruby
|
97
|
+
prerelease: false
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
type: :development
|
107
|
+
version_requirements: *id006
|
108
|
+
description: "\n\
|
109
|
+
Resque is great. So is job processing with redis. Our biggest drawback has been that\n\
|
110
|
+
resque requires the class that will be processing a job to be loaded when the job \n\
|
111
|
+
is enqueued. But what happens when the implementing job is defined in a separate application\n\
|
112
|
+
and isn't currently loaded into memory?\n\n\
|
113
|
+
Enter Resque Remote.\n\n\
|
114
|
+
Resque Remote's simple goal is to allow you to add a job to a queue with a string\n\
|
115
|
+
identifier for the class rather than the class constant. It is assumed that the worker-side of\n\
|
116
|
+
the equation _will_ have the class in memory and hence will be able to run it no problem.\n\n\
|
117
|
+
Feedback, comments and questions are welcome at bj [dot] neilsen [at] gmail [dot] com.\n"
|
118
|
+
email:
|
119
|
+
- bj.neilsen@gmail.com
|
120
|
+
executables: []
|
121
|
+
|
122
|
+
extensions: []
|
123
|
+
|
124
|
+
extra_rdoc_files: []
|
125
|
+
|
126
|
+
files:
|
127
|
+
- .gitignore
|
128
|
+
- Gemfile
|
129
|
+
- Gemfile.lock
|
130
|
+
- Rakefile
|
131
|
+
- lib/resque-remote.rb
|
132
|
+
- lib/resque-remote/remote.rb
|
133
|
+
- lib/resque-remote/version.rb
|
134
|
+
- resque-remote.gemspec
|
135
|
+
- spec/remote_spec.rb
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
has_rdoc: true
|
138
|
+
homepage: http://github.com/localshred/resque-remote
|
139
|
+
licenses: []
|
140
|
+
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
segments:
|
160
|
+
- 1
|
161
|
+
- 3
|
162
|
+
- 6
|
163
|
+
version: 1.3.6
|
164
|
+
requirements: []
|
165
|
+
|
166
|
+
rubyforge_project: resque-remote
|
167
|
+
rubygems_version: 1.3.7
|
168
|
+
signing_key:
|
169
|
+
specification_version: 3
|
170
|
+
summary: Resque plugin to allow remote job droppability
|
171
|
+
test_files: []
|
172
|
+
|