brightbox-warren 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/lib/warren/adapters/dummy_adapter.rb +12 -0
- data/lib/warren/adapters/test_adapter.rb +27 -0
- data/spec/warren/adapters/test_adapter_spec.rb +29 -0
- data/warren.gemspec +3 -3
- metadata +6 -1
data/CHANGELOG
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
class DummyAdapter < Warren::Queue
|
4
|
+
def self.publish queue_name, payload, &blk
|
5
|
+
puts "publishing #{payload.inspect} to #{queue_name}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.subscribe queue_name, &block
|
9
|
+
puts "subscribing to #{queue_name}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
class TestAdapter < Warren::Queue
|
4
|
+
ConnectionFailed = Class.new(Exception)
|
5
|
+
#
|
6
|
+
def self.publish queue_name, payload, &blk
|
7
|
+
raise TestAdapter::ConnectionFailed if fail?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# def self.subscribe queue_name, &block
|
13
|
+
# puts "subscribing to #{queue_name}"
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def self.fail?
|
20
|
+
File.exists?(file_name) && (File.read(file_name, 4) == "FAIL")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.file_name
|
24
|
+
"#{WARREN_ROOT}/tmp/warren.txt"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
require "#{File.dirname(__FILE__)}/../../../lib/warren/adapters/test_adapter.rb"
|
3
|
+
|
4
|
+
describe TestAdapter do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
@file_name = "#{WARREN_ROOT}/tmp/warren.txt"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return true from publish without a tmp file" do
|
11
|
+
TestAdapter.publish(:queue_name, :payload).should == true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return true from publish with a tmp file which doesn't say \"FAIL\"" do
|
15
|
+
File.should_receive(:exists?).with(@file_name).and_return(true)
|
16
|
+
File.should_receive(:read).with(@file_name, 4).and_return("blah")
|
17
|
+
|
18
|
+
TestAdapter.publish(:queue_name, :payload).should == true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should raise an error when tmp file exists and says \"FAIL\"" do
|
22
|
+
File.should_receive(:exists?).with(@file_name).and_return(true)
|
23
|
+
File.should_receive(:read).with(@file_name, 4).and_return("FAIL")
|
24
|
+
|
25
|
+
lambda { TestAdapter.publish(:queue_name, :payload) }.
|
26
|
+
should raise_error(TestAdapter::ConnectionFailed)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/warren.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{warren}
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Caius Durling, David Smalley"]
|
9
9
|
s.date = %q{2009-07-03}
|
10
10
|
s.description = %q{Library for pushing messages onto and off RabbitMQ queues}
|
11
11
|
s.email = %q{support@brightbox.co.uk}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG", "lib/warren/adapters/amqp_adapter.rb", "lib/warren/adapters/bunny_adapter.rb", "lib/warren/connection.rb", "lib/warren/filters/shared_secret.rb", "lib/warren/filters/yaml.rb", "lib/warren/message_filter.rb", "lib/warren/queue.rb", "lib/warren.rb", "LICENSE", "tasks/rdoc.rake", "tasks/rspec.rake"]
|
13
|
-
s.files = ["CHANGELOG", "examples/authed/receiver.rb", "examples/authed/secret.rb", "examples/authed/sender.rb", "examples/simple/amqp_mass_sender.rb", "examples/simple/amqp_receiver.rb", "examples/simple/amqp_sender.rb", "examples/simple/bunny_receiver.rb", "examples/simple/bunny_sender.rb", "lib/warren/adapters/amqp_adapter.rb", "lib/warren/adapters/bunny_adapter.rb", "lib/warren/connection.rb", "lib/warren/filters/shared_secret.rb", "lib/warren/filters/yaml.rb", "lib/warren/message_filter.rb", "lib/warren/queue.rb", "lib/warren.rb", "LICENSE", "Manifest", "Rakefile", "readme.rdoc", "spec/spec.opts", "spec/spec_helper.rb", "spec/warren/connection_spec.rb", "spec/warren/queue_spec.rb", "spec/warren/warren_spec.rb", "tasks/rdoc.rake", "tasks/rspec.rake", "warren.gemspec"]
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/warren/adapters/amqp_adapter.rb", "lib/warren/adapters/bunny_adapter.rb", "lib/warren/adapters/dummy_adapter.rb", "lib/warren/adapters/test_adapter.rb", "lib/warren/connection.rb", "lib/warren/filters/shared_secret.rb", "lib/warren/filters/yaml.rb", "lib/warren/message_filter.rb", "lib/warren/queue.rb", "lib/warren.rb", "LICENSE", "tasks/rdoc.rake", "tasks/rspec.rake"]
|
13
|
+
s.files = ["CHANGELOG", "examples/authed/receiver.rb", "examples/authed/secret.rb", "examples/authed/sender.rb", "examples/simple/amqp_mass_sender.rb", "examples/simple/amqp_receiver.rb", "examples/simple/amqp_sender.rb", "examples/simple/bunny_receiver.rb", "examples/simple/bunny_sender.rb", "lib/warren/adapters/amqp_adapter.rb", "lib/warren/adapters/bunny_adapter.rb", "lib/warren/adapters/dummy_adapter.rb", "lib/warren/adapters/test_adapter.rb", "lib/warren/connection.rb", "lib/warren/filters/shared_secret.rb", "lib/warren/filters/yaml.rb", "lib/warren/message_filter.rb", "lib/warren/queue.rb", "lib/warren.rb", "LICENSE", "Manifest", "Rakefile", "readme.rdoc", "spec/spec.opts", "spec/spec_helper.rb", "spec/warren/adapters/test_adapter_spec.rb", "spec/warren/connection_spec.rb", "spec/warren/queue_spec.rb", "spec/warren/warren_spec.rb", "tasks/rdoc.rake", "tasks/rspec.rake", "warren.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/brightbox/warren}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Warren", "--main", "readme.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox-warren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caius Durling, David Smalley
|
@@ -32,6 +32,8 @@ extra_rdoc_files:
|
|
32
32
|
- CHANGELOG
|
33
33
|
- lib/warren/adapters/amqp_adapter.rb
|
34
34
|
- lib/warren/adapters/bunny_adapter.rb
|
35
|
+
- lib/warren/adapters/dummy_adapter.rb
|
36
|
+
- lib/warren/adapters/test_adapter.rb
|
35
37
|
- lib/warren/connection.rb
|
36
38
|
- lib/warren/filters/shared_secret.rb
|
37
39
|
- lib/warren/filters/yaml.rb
|
@@ -53,6 +55,8 @@ files:
|
|
53
55
|
- examples/simple/bunny_sender.rb
|
54
56
|
- lib/warren/adapters/amqp_adapter.rb
|
55
57
|
- lib/warren/adapters/bunny_adapter.rb
|
58
|
+
- lib/warren/adapters/dummy_adapter.rb
|
59
|
+
- lib/warren/adapters/test_adapter.rb
|
56
60
|
- lib/warren/connection.rb
|
57
61
|
- lib/warren/filters/shared_secret.rb
|
58
62
|
- lib/warren/filters/yaml.rb
|
@@ -65,6 +69,7 @@ files:
|
|
65
69
|
- readme.rdoc
|
66
70
|
- spec/spec.opts
|
67
71
|
- spec/spec_helper.rb
|
72
|
+
- spec/warren/adapters/test_adapter_spec.rb
|
68
73
|
- spec/warren/connection_spec.rb
|
69
74
|
- spec/warren/queue_spec.rb
|
70
75
|
- spec/warren/warren_spec.rb
|