rock-queue 0.3.2 → 0.3.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/Rakefile +4 -2
- data/lib/rock-queue/active_record_helper.rb +1 -1
- data/lib/rock-queue/notifiers/email_notifier.rb +6 -6
- data/lib/rock-queue/worker.rb +2 -0
- data/spec/active_record_helper_spec.rb +1 -1
- data/spec/email_notifier_spec.rb +0 -2
- data/spec/notifiers_spec.rb +0 -2
- data/spec/resque_queue_spec.rb +1 -1
- data/spec/rock_queue_spec.rb +23 -0
- metadata +29 -4
data/Rakefile
CHANGED
|
@@ -7,13 +7,14 @@ $LOAD_PATH.unshift 'lib'
|
|
|
7
7
|
require 'rock-queue/tasks'
|
|
8
8
|
|
|
9
9
|
GEM = "rock-queue"
|
|
10
|
-
GEM_VERSION = "0.3.
|
|
10
|
+
GEM_VERSION = "0.3.3"
|
|
11
11
|
SUMMARY = "A unified interface for various messaging queues"
|
|
12
|
-
AUTHORS = ["Grzegorz Kazulak"]
|
|
12
|
+
AUTHORS = ["Grzegorz Kazulak", "Wojtek Mach", "Piotr Chmolowski", "Daniel Chrusciak"]
|
|
13
13
|
EMAIL = "gregorz.kazulak@gmail.com"
|
|
14
14
|
HOMEPAGE = "http://github.com/grzegorzkazulak/rock-queue"
|
|
15
15
|
|
|
16
16
|
begin
|
|
17
|
+
gem 'jeweler', '~> 1.4'
|
|
17
18
|
require 'jeweler'
|
|
18
19
|
Jeweler::Tasks.new do |gem|
|
|
19
20
|
gem.name = GEM
|
|
@@ -38,6 +39,7 @@ begin
|
|
|
38
39
|
gem.extra_rdoc_files = ["LICENSE"]
|
|
39
40
|
end
|
|
40
41
|
Jeweler::GemcutterTasks.new
|
|
42
|
+
FileList['tasks/**/*.rake'].each { |task| import task }
|
|
41
43
|
rescue LoadError
|
|
42
44
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
43
45
|
end
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'mail'
|
|
3
|
+
rescue
|
|
4
|
+
RockQueue.logger.error "You need `mail` gem to use the Email Notifier"
|
|
5
|
+
end
|
|
6
|
+
|
|
1
7
|
module RockQueue
|
|
2
8
|
class EmailNotifier < AbstractNotifier
|
|
3
9
|
def initialize(config)
|
|
@@ -15,12 +21,6 @@ module RockQueue
|
|
|
15
21
|
|
|
16
22
|
# Notify by email
|
|
17
23
|
def update(error)
|
|
18
|
-
begin
|
|
19
|
-
require 'mail'
|
|
20
|
-
rescue
|
|
21
|
-
RockQueue.logger.error "You need `mail` gem to use the Email Notifier"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
24
|
RockQueue.logger.info "Sending e-mail message: #{error.message}"
|
|
25
25
|
|
|
26
26
|
Mail.deliver do
|
data/lib/rock-queue/worker.rb
CHANGED
|
@@ -34,7 +34,7 @@ describe "Object with ActiveRecordHelper" do
|
|
|
34
34
|
|
|
35
35
|
Resque.delayed_queue_schedule_size.should == 1
|
|
36
36
|
Resque.next_item_for_timestamp(time).should == {
|
|
37
|
-
"args" => [[
|
|
37
|
+
"args" => [[@post.id, "archive"]],
|
|
38
38
|
"class" => "Post",
|
|
39
39
|
"queue" => "default"
|
|
40
40
|
}
|
data/spec/email_notifier_spec.rb
CHANGED
data/spec/notifiers_spec.rb
CHANGED
data/spec/resque_queue_spec.rb
CHANGED
|
@@ -14,7 +14,7 @@ describe "ResqueQueue" do
|
|
|
14
14
|
|
|
15
15
|
it_should_behave_like "RockQueue adapter"
|
|
16
16
|
|
|
17
|
-
it "should register worker" do
|
|
17
|
+
it "should register worker" do
|
|
18
18
|
worker = RockQueue::Worker.new(:default)
|
|
19
19
|
@adapter.register_worker(worker)
|
|
20
20
|
Resque.redis.sismember(:workers, worker).should == true
|
data/spec/rock_queue_spec.rb
CHANGED
|
@@ -30,4 +30,27 @@ describe "RockQueue" do
|
|
|
30
30
|
RockQueue.disconnect
|
|
31
31
|
lambda { RockQueue.adapter }.should raise_error
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
it "should register worker" do
|
|
35
|
+
RockQueue.setup :adapter => :resque,
|
|
36
|
+
:server => 'localhost',
|
|
37
|
+
:port => 6379
|
|
38
|
+
|
|
39
|
+
worker = RockQueue::Worker.new(:default)
|
|
40
|
+
RockQueue.register_worker(worker)
|
|
41
|
+
Resque.redis.sismember(:workers, worker).should == true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should pull data off the queue when the receive method is called" do
|
|
45
|
+
RockQueue.push(:default, TestJob, 1)
|
|
46
|
+
RockQueue.receive(:default) do |obj|
|
|
47
|
+
obj.should be_an_instance_of(RockQueue::QueueObject)
|
|
48
|
+
obj.object.should == TestJob
|
|
49
|
+
obj.args.should == [[1]]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "should raise error when there's no block for the receive method" do
|
|
54
|
+
lambda { RockQueue.receive(:default) }.should raise_error('No block given')
|
|
55
|
+
end
|
|
33
56
|
end
|
metadata
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rock-queue
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 21
|
|
4
5
|
prerelease: false
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
8
|
- 3
|
|
8
|
-
-
|
|
9
|
-
version: 0.3.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.3.3
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Grzegorz Kazulak
|
|
14
|
+
- Wojtek Mach
|
|
15
|
+
- Piotr Chmolowski
|
|
16
|
+
- Daniel Chrusciak
|
|
13
17
|
autorequire: rock-queue
|
|
14
18
|
bindir: bin
|
|
15
19
|
cert_chain: []
|
|
16
20
|
|
|
17
|
-
date: 2010-
|
|
21
|
+
date: 2010-09-01 00:00:00 +02:00
|
|
18
22
|
default_executable:
|
|
19
23
|
dependencies:
|
|
20
24
|
- !ruby/object:Gem::Dependency
|
|
21
25
|
name: rspec
|
|
22
26
|
prerelease: false
|
|
23
27
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
28
|
+
none: false
|
|
24
29
|
requirements:
|
|
25
30
|
- - ">="
|
|
26
31
|
- !ruby/object:Gem::Version
|
|
32
|
+
hash: 13
|
|
27
33
|
segments:
|
|
28
34
|
- 1
|
|
29
35
|
- 2
|
|
@@ -35,9 +41,11 @@ dependencies:
|
|
|
35
41
|
name: resque
|
|
36
42
|
prerelease: false
|
|
37
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
44
|
+
none: false
|
|
38
45
|
requirements:
|
|
39
46
|
- - ">="
|
|
40
47
|
- !ruby/object:Gem::Version
|
|
48
|
+
hash: 33
|
|
41
49
|
segments:
|
|
42
50
|
- 1
|
|
43
51
|
- 9
|
|
@@ -49,9 +57,11 @@ dependencies:
|
|
|
49
57
|
name: mail
|
|
50
58
|
prerelease: false
|
|
51
59
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
60
|
+
none: false
|
|
52
61
|
requirements:
|
|
53
62
|
- - ">="
|
|
54
63
|
- !ruby/object:Gem::Version
|
|
64
|
+
hash: 13
|
|
55
65
|
segments:
|
|
56
66
|
- 2
|
|
57
67
|
- 2
|
|
@@ -85,6 +95,17 @@ files:
|
|
|
85
95
|
- lib/rock-queue/web.rb
|
|
86
96
|
- lib/rock-queue/web/views/dashboard.erb
|
|
87
97
|
- lib/rock-queue/worker.rb
|
|
98
|
+
- spec/active_record_helper_spec.rb
|
|
99
|
+
- spec/beanstalkd_spec.rb
|
|
100
|
+
- spec/email_notifier_spec.rb
|
|
101
|
+
- spec/fixtures.rb
|
|
102
|
+
- spec/notifiers_spec.rb
|
|
103
|
+
- spec/queue_object_spec.rb
|
|
104
|
+
- spec/resque_queue_spec.rb
|
|
105
|
+
- spec/rock_queue_spec.rb
|
|
106
|
+
- spec/shared.rb
|
|
107
|
+
- spec/spec_helper.rb
|
|
108
|
+
- spec/worker_spec.rb
|
|
88
109
|
has_rdoc: true
|
|
89
110
|
homepage: http://github.com/grzegorzkazulak/rock-queue
|
|
90
111
|
licenses: []
|
|
@@ -95,23 +116,27 @@ rdoc_options:
|
|
|
95
116
|
require_paths:
|
|
96
117
|
- lib
|
|
97
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
|
+
none: false
|
|
98
120
|
requirements:
|
|
99
121
|
- - ">="
|
|
100
122
|
- !ruby/object:Gem::Version
|
|
123
|
+
hash: 3
|
|
101
124
|
segments:
|
|
102
125
|
- 0
|
|
103
126
|
version: "0"
|
|
104
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
|
+
none: false
|
|
105
129
|
requirements:
|
|
106
130
|
- - ">="
|
|
107
131
|
- !ruby/object:Gem::Version
|
|
132
|
+
hash: 3
|
|
108
133
|
segments:
|
|
109
134
|
- 0
|
|
110
135
|
version: "0"
|
|
111
136
|
requirements: []
|
|
112
137
|
|
|
113
138
|
rubyforge_project:
|
|
114
|
-
rubygems_version: 1.3.
|
|
139
|
+
rubygems_version: 1.3.7
|
|
115
140
|
signing_key:
|
|
116
141
|
specification_version: 3
|
|
117
142
|
summary: A unified interface for various messaging queues
|