superbolt 0.2.3 → 0.3.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/superbolt.rb +3 -1
- data/lib/superbolt/adapter/amqp.rb +18 -0
- data/lib/superbolt/adapter/base.rb +7 -1
- data/lib/superbolt/adapter/bunny.rb +2 -6
- data/lib/superbolt/app.rb +4 -5
- data/lib/superbolt/config.rb +9 -0
- data/lib/superbolt/connection/app.rb +4 -5
- data/lib/superbolt/connection/base.rb +3 -11
- data/lib/superbolt/connection/queue.rb +8 -3
- data/lib/superbolt/facade.rb +4 -2
- data/lib/superbolt/messenger.rb +2 -13
- data/lib/superbolt/queue.rb +13 -13
- data/lib/superbolt/version.rb +1 -1
- data/spec/app_spec.rb +2 -1
- data/spec/config_spec.rb +20 -1
- data/spec/connection_spec.rb +4 -7
- data/spec/messenger_spec.rb +0 -53
- data/spec/queue_spec.rb +15 -10
- data/spec/superbolt_spec.rb +23 -7
- data/superbolt.gemspec +3 -2
- metadata +33 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f5e8511ce0d7491cf249678f90c650bdcbd78c0
|
4
|
+
data.tar.gz: 9e57a9143eb61aa617f2ae021a952f6ab5cf0143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b03bdffeee9f4f2894b21486369990a2b8c919b5a4d75e319eb5d90b52baace03e1fc9bdc283b0615d5023a186e180e1ef41375226907675049024883aaa7a50
|
7
|
+
data.tar.gz: 27494bd318f971156714870eb6aca2213ecc3166440a5e47ce542de63740f30c543f632075e68a402a527e8199a75f98d239042340644f7990ed7532233b05b7
|
data/README.md
CHANGED
data/lib/superbolt.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
require 'bunny'
|
4
|
-
require '
|
4
|
+
require 'amqp'
|
5
5
|
require 'eventmachine'
|
6
|
+
require 'active_support/core_ext/module/delegation'
|
6
7
|
|
7
8
|
require "superbolt/version"
|
8
9
|
require "superbolt/config"
|
9
10
|
require "superbolt/adapter/base"
|
10
11
|
require "superbolt/adapter/bunny"
|
12
|
+
require "superbolt/adapter/amqp"
|
11
13
|
require "superbolt/connection/base"
|
12
14
|
require "superbolt/connection/queue"
|
13
15
|
require "superbolt/connection/app"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Superbolt
|
2
|
+
module Adapter
|
3
|
+
class AMQP < Base
|
4
|
+
def socket
|
5
|
+
@socket ||= ::AMQP.connect(config.connection_params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def channel
|
9
|
+
@channel ||= ::AMQP::Channel.new(socket)
|
10
|
+
end
|
11
|
+
|
12
|
+
def close(&block)
|
13
|
+
socket.close(&block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -5,7 +5,6 @@ module Superbolt
|
|
5
5
|
|
6
6
|
def initialize(config=nil)
|
7
7
|
@config = config || Superbolt.config
|
8
|
-
@channel = new_channel
|
9
8
|
end
|
10
9
|
|
11
10
|
delegate :closed?, :open, :open?,
|
@@ -17,6 +16,13 @@ module Superbolt
|
|
17
16
|
@channel = nil
|
18
17
|
response
|
19
18
|
end
|
19
|
+
|
20
|
+
delegate :queues, :acknowledge, :reject, :queue,
|
21
|
+
to: :channel
|
22
|
+
|
23
|
+
def exchange
|
24
|
+
channel.default_exchange
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
data/lib/superbolt/app.rb
CHANGED
@@ -19,7 +19,7 @@ module Superbolt
|
|
19
19
|
end
|
20
20
|
|
21
21
|
delegate :close, :closing, :exclusive?, :durable?, :auto_delete?,
|
22
|
-
:channel, :q,
|
22
|
+
:writer, :channel, :q,
|
23
23
|
to: :connection
|
24
24
|
|
25
25
|
def queue
|
@@ -40,7 +40,7 @@ module Superbolt
|
|
40
40
|
|
41
41
|
def run(&block)
|
42
42
|
EventMachine.run do
|
43
|
-
queue.subscribe(ack: false) do |metadata,
|
43
|
+
queue.subscribe(ack: false) do |metadata, payload|
|
44
44
|
message = IncomingMessage.new(metadata, payload, channel)
|
45
45
|
processor = Processor.new(message, logger, &block)
|
46
46
|
unless processor.perform
|
@@ -48,9 +48,8 @@ module Superbolt
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
quit_subscriber_queue.subscribe do |
|
52
|
-
|
53
|
-
quit(parsed_payload['message'])
|
51
|
+
quit_subscriber_queue.subscribe do |message|
|
52
|
+
quit(message)
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
data/lib/superbolt/config.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
module Superbolt
|
2
2
|
class Config
|
3
3
|
attr_reader :options
|
4
|
+
attr_writer :app_name, :env
|
4
5
|
|
5
6
|
def initialize(options={})
|
6
7
|
@options = options
|
7
8
|
end
|
8
9
|
|
10
|
+
def app_name
|
11
|
+
@app_name ||= options[:app_name]
|
12
|
+
end
|
13
|
+
|
14
|
+
def env
|
15
|
+
@env ||= options[:env]
|
16
|
+
end
|
17
|
+
|
9
18
|
def connection_params
|
10
19
|
env_params || default
|
11
20
|
end
|
@@ -2,19 +2,18 @@ module Superbolt
|
|
2
2
|
module Connection
|
3
3
|
class App < Base
|
4
4
|
def connection
|
5
|
-
|
5
|
+
@connection ||= Adapter::AMQP.new(config)
|
6
6
|
end
|
7
7
|
|
8
8
|
def close(&block)
|
9
|
-
|
10
|
-
@
|
9
|
+
connection.close(&block)
|
10
|
+
@connection = nil
|
11
11
|
@q = nil
|
12
12
|
@qq = nil
|
13
|
-
block.call
|
14
13
|
end
|
15
14
|
|
16
15
|
def qq
|
17
|
-
@qq ||=
|
16
|
+
@qq ||= connection.queue("#{name}.quit", self.class.default_options)
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
@@ -17,24 +17,16 @@ module Superbolt
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def q
|
20
|
-
@q ||=
|
20
|
+
@q ||= connection.queue(name, self.class.default_options)
|
21
21
|
end
|
22
22
|
|
23
23
|
delegate :exclusive?, :durable?, :auto_delete?,
|
24
24
|
to: :q
|
25
25
|
|
26
26
|
def channel
|
27
|
-
|
28
|
-
tries = 0
|
29
|
-
begin
|
30
|
-
@channel = connection.new_channel
|
31
|
-
rescue ::Bunny::CommandInvalid # only happens if a channel is already open
|
32
|
-
@channel.close
|
33
|
-
tries += 1
|
34
|
-
retry if tries < 2
|
35
|
-
end
|
27
|
+
connection.channel
|
36
28
|
end
|
37
|
-
|
29
|
+
|
38
30
|
def self.default_options
|
39
31
|
{
|
40
32
|
:auto_delete => false,
|
@@ -2,12 +2,12 @@ module Superbolt
|
|
2
2
|
module Connection
|
3
3
|
class Queue < Base
|
4
4
|
def connection
|
5
|
-
|
5
|
+
@connection ||= Adapter::Bunny.new(config)
|
6
6
|
end
|
7
7
|
|
8
8
|
def close
|
9
|
-
|
10
|
-
@
|
9
|
+
connection.close
|
10
|
+
@connection = nil
|
11
11
|
@q = nil
|
12
12
|
end
|
13
13
|
|
@@ -16,6 +16,11 @@ module Superbolt
|
|
16
16
|
close
|
17
17
|
response
|
18
18
|
end
|
19
|
+
|
20
|
+
def writer
|
21
|
+
q # to make sure it is connected
|
22
|
+
connection.exchange
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
data/lib/superbolt/facade.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
module Superbolt
|
2
2
|
|
3
3
|
def self.config=(options)
|
4
|
-
@config = Config.new(
|
4
|
+
@config = Config.new({
|
5
|
+
env: env,
|
6
|
+
app_name: app_name
|
7
|
+
}.merge(options))
|
5
8
|
end
|
6
9
|
|
7
10
|
def self.config
|
@@ -24,5 +27,4 @@ module Superbolt
|
|
24
27
|
def self.message(args={})
|
25
28
|
Superbolt::Messenger.new(args)
|
26
29
|
end
|
27
|
-
CONNECTION = Adapter::Bunny.new(config)
|
28
30
|
end
|
data/lib/superbolt/messenger.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Superbolt
|
2
2
|
class Messenger
|
3
|
-
attr_accessor :origin, :name, :event, :arguments, :env
|
3
|
+
attr_accessor :origin, :name, :event, :arguments, :env
|
4
4
|
|
5
5
|
def initialize(options={})
|
6
6
|
@name = options.delete(:to)
|
@@ -8,8 +8,6 @@ module Superbolt
|
|
8
8
|
@event = options.delete(:event) || self.class.defaultevent
|
9
9
|
@env = Superbolt.env
|
10
10
|
@arguments = options
|
11
|
-
@retry_time = Superbolt.config.options[:retry_time] || 10
|
12
|
-
@timeout = Superbolt.config.options[:timeout] || 60
|
13
11
|
end
|
14
12
|
|
15
13
|
def message
|
@@ -38,14 +36,6 @@ module Superbolt
|
|
38
36
|
attr_chainer(:arguments, val)
|
39
37
|
end
|
40
38
|
|
41
|
-
def retry_after(val=nil)
|
42
|
-
attr_chainer(:retry_time, val)
|
43
|
-
end
|
44
|
-
|
45
|
-
def timeout_after(val=nil)
|
46
|
-
attr_chainer(:timeout, val)
|
47
|
-
end
|
48
|
-
|
49
39
|
def attr_chainer(attr, val)
|
50
40
|
return send(attr) unless val
|
51
41
|
self.send("#{attr}=", val)
|
@@ -60,12 +50,11 @@ module Superbolt
|
|
60
50
|
queue.push(message)
|
61
51
|
end
|
62
52
|
|
63
|
-
|
64
53
|
def queue
|
65
54
|
unless name
|
66
55
|
raise "no destination app name defined, please pass one in"
|
67
56
|
end
|
68
|
-
|
57
|
+
Queue.new(destination_name)
|
69
58
|
end
|
70
59
|
|
71
60
|
def destination_name
|
data/lib/superbolt/queue.rb
CHANGED
@@ -12,36 +12,36 @@ module Superbolt
|
|
12
12
|
end
|
13
13
|
|
14
14
|
delegate :close, :closing, :exclusive?, :durable?, :auto_delete?,
|
15
|
-
|
16
|
-
|
15
|
+
:writer, :channel, :q,
|
16
|
+
to: :connection
|
17
17
|
|
18
18
|
def push(message)
|
19
19
|
closing do
|
20
|
-
|
20
|
+
writer.publish(message.to_json, routing_key: name)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
def size
|
25
|
-
|
25
|
+
closing do
|
26
|
+
q.message_count
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def clear
|
29
|
-
|
31
|
+
closing do
|
32
|
+
q.purge
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
# TODO: roll up some of these subscribe methods
|
33
37
|
|
34
38
|
def read
|
35
|
-
current_size = size
|
36
39
|
messages = []
|
37
40
|
closing do
|
38
41
|
q.subscribe(:ack => true) do |delivery_info, metadata, payload|
|
39
42
|
message = IncomingMessage.new(delivery_info, payload, channel)
|
40
43
|
messages << message
|
41
44
|
end
|
42
|
-
while messages.length < current_size
|
43
|
-
true
|
44
|
-
end
|
45
45
|
end
|
46
46
|
messages
|
47
47
|
end
|
@@ -58,15 +58,15 @@ module Superbolt
|
|
58
58
|
|
59
59
|
def pop
|
60
60
|
closing do
|
61
|
-
q.pop
|
62
|
-
message = IncomingMessage.new(delivery_info,
|
61
|
+
q.pop do |delivery_info, metadata, message|
|
62
|
+
message = IncomingMessage.new(delivery_info, message, channel)
|
63
63
|
message && message.parse
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
delegate :slice, :[],
|
69
|
-
|
69
|
+
to: :all
|
70
70
|
|
71
71
|
def delete
|
72
72
|
messages = []
|
@@ -79,11 +79,11 @@ module Superbolt
|
|
79
79
|
message.ack
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
82
83
|
# channel is closed by block before message ack can complete
|
83
84
|
# therefore we must sleep :(
|
84
85
|
sleep 0.02
|
85
86
|
end
|
86
|
-
|
87
87
|
messages
|
88
88
|
end
|
89
89
|
end
|
data/lib/superbolt/version.rb
CHANGED
data/spec/app_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Superbolt::App do
|
4
4
|
let(:env) { 'test' }
|
5
5
|
let(:name) { 'superbolt' }
|
6
|
-
let(:logger) { Logger.new(
|
6
|
+
let(:logger) { Logger.new('/dev/null') }
|
7
7
|
let(:app) {
|
8
8
|
Superbolt::App.new(name, {
|
9
9
|
env: env,
|
@@ -24,6 +24,7 @@ describe Superbolt::App do
|
|
24
24
|
describe '#run' do
|
25
25
|
it "shuts down with any message to the quit queue" do
|
26
26
|
queue.push({please: 'stop'})
|
27
|
+
|
27
28
|
app.run do |arguments|
|
28
29
|
quit_queue.push({message: 'just because'})
|
29
30
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -9,6 +9,23 @@ describe Superbolt::Config do
|
|
9
9
|
{}
|
10
10
|
}
|
11
11
|
|
12
|
+
describe 'non connection configuration' do
|
13
|
+
let(:options) {
|
14
|
+
{
|
15
|
+
app_name: 'my_great_app',
|
16
|
+
env: 'staging'
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
it "should make the app name available" do
|
21
|
+
config.app_name.should == 'my_great_app'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should make the env available" do
|
25
|
+
config.env.should == 'staging'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
12
29
|
describe '#connection' do
|
13
30
|
context "environmental variables" do
|
14
31
|
context 'default behavior' do
|
@@ -33,7 +50,9 @@ describe Superbolt::Config do
|
|
33
50
|
let(:old_value) { ENV['SOMEOTHERURL'] }
|
34
51
|
let(:url) { 'http://someother-url.com' }
|
35
52
|
let(:options) {
|
36
|
-
{
|
53
|
+
{
|
54
|
+
connection_key: 'SOMEOTHERURL'
|
55
|
+
}
|
37
56
|
}
|
38
57
|
|
39
58
|
before do
|
data/spec/connection_spec.rb
CHANGED
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Superbolt::Adapter::Bunny do
|
4
4
|
let(:connection) { Superbolt::Adapter::Bunny.new }
|
5
|
-
let(:channel) { connection.new_channel }
|
6
5
|
|
7
6
|
it "has an underlying open connection via Bunny" do
|
8
7
|
connection.socket.should be_a Bunny::Session
|
@@ -10,15 +9,13 @@ describe Superbolt::Adapter::Bunny do
|
|
10
9
|
connection.should be_open
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
connection.new_channel.should be_a Bunny::Channel
|
16
|
-
end
|
12
|
+
it "has a channel" do
|
13
|
+
connection.channel.should be_a Bunny::Channel
|
17
14
|
end
|
18
15
|
|
19
16
|
it "delegates queue creation to the channel" do
|
20
|
-
queue =
|
17
|
+
queue = connection.queue('changelica')
|
21
18
|
queue.should be_a Bunny::Queue
|
22
|
-
|
19
|
+
connection.queues.keys.should include('changelica')
|
23
20
|
end
|
24
21
|
end
|
data/spec/messenger_spec.rb
CHANGED
@@ -78,64 +78,11 @@ describe Superbolt::Messenger do
|
|
78
78
|
messenger.data({foo: 'bar'})
|
79
79
|
messenger.data.should == {foo: 'bar'}
|
80
80
|
end
|
81
|
-
|
82
|
-
describe '#retry_time' do
|
83
|
-
before do
|
84
|
-
Superbolt.config.options[:retry_time] = nil
|
85
|
-
end
|
86
|
-
|
87
|
-
context 'config contains retry_time' do
|
88
|
-
it 'returns config value' do
|
89
|
-
Superbolt.config.options[:retry_time] = 12
|
90
|
-
messenger.retry_after.should == 12
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'config does not contain retry_time but we pass it in' do
|
95
|
-
it 'returns passed in value' do
|
96
|
-
messenger.retry_after(11)
|
97
|
-
messenger.retry_after.should == 11
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context 'config does not contain retry_time and we dont pass it in' do
|
102
|
-
it 'returns default value' do
|
103
|
-
messenger.retry_after.should == 10
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe '#retry_time' do
|
109
|
-
before do
|
110
|
-
Superbolt.config.options[:timeout] = nil
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'config contains retry_time' do
|
114
|
-
it 'returns config value' do
|
115
|
-
Superbolt.config.options[:timeout] = 120
|
116
|
-
messenger.timeout_after.should == 120
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'config does not contain retry_time but we pass it in' do
|
121
|
-
it 'returns passed in value' do
|
122
|
-
messenger.timeout_after(90)
|
123
|
-
messenger.timeout_after.should == 90
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
context 'config does not contain retry_time and we dont pass it in' do
|
128
|
-
it 'returns default value' do
|
129
|
-
messenger.timeout_after.should == 60
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
81
|
end
|
134
82
|
end
|
135
83
|
|
136
84
|
describe 'send!' do
|
137
85
|
before do
|
138
|
-
Superbolt.config.options[:retry_time] = 0
|
139
86
|
messenger
|
140
87
|
.to(name)
|
141
88
|
.from('me')
|
data/spec/queue_spec.rb
CHANGED
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Superbolt::Queue' do
|
4
4
|
let(:name) { 'superbolt_test' }
|
5
|
+
let(:connection) { Superbolt::Connection.new }
|
5
6
|
let(:queue) { Superbolt::Queue.new(name) }
|
6
7
|
let(:messages) { [] }
|
7
8
|
|
@@ -22,12 +23,13 @@ describe 'Superbolt::Queue' do
|
|
22
23
|
describe 'queue/array operations' do
|
23
24
|
let(:message) { {hello: 'insomniacs'} }
|
24
25
|
let(:message_two) { {:hello => 'early birds'} }
|
26
|
+
|
25
27
|
let(:decoded) { {'hello' => 'insomniacs'} }
|
26
28
|
let(:decoded_two) { {'hello' => 'early birds'} }
|
27
29
|
|
28
30
|
describe '#push' do
|
29
31
|
let(:bunny_queue) {connection.queue(name, Superbolt::Queue.default_options)}
|
30
|
-
|
32
|
+
|
31
33
|
it "writes to the queue" do
|
32
34
|
queue.push(message)
|
33
35
|
queue.size.should == 1
|
@@ -38,7 +40,7 @@ describe 'Superbolt::Queue' do
|
|
38
40
|
it "returns the message but leaves it in the queue" do
|
39
41
|
queue.push(message)
|
40
42
|
queue.peek.should == decoded
|
41
|
-
queue.size.should == 1
|
43
|
+
queue.size.should == 1
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -59,15 +61,19 @@ describe 'Superbolt::Queue' do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
describe '#all' do
|
62
|
-
before do
|
64
|
+
before do
|
63
65
|
queue.push(message)
|
64
66
|
queue.push(message)
|
65
67
|
queue.push(message)
|
66
68
|
end
|
67
69
|
|
68
|
-
it "returns all the messages on the queue
|
69
|
-
|
70
|
-
|
70
|
+
it "returns all the messages on the queue" do
|
71
|
+
messages = queue.all
|
72
|
+
messages.size.should == 3
|
73
|
+
messages.uniq.should == [decoded]
|
74
|
+
end
|
75
|
+
|
76
|
+
it "does not consume the messages" do
|
71
77
|
queue.size.should == 3
|
72
78
|
end
|
73
79
|
end
|
@@ -112,8 +118,8 @@ describe 'Superbolt::Queue' do
|
|
112
118
|
end
|
113
119
|
|
114
120
|
it "returns all messages where the block is true" do
|
115
|
-
messages = queue.delete{|json| json['i']
|
116
|
-
messages.map{|json| json['i']}.should == [
|
121
|
+
messages = queue.delete{|json| json['i'] > 2 && json['i'] != 6 && json['i'] < 8 }
|
122
|
+
messages.map{|json| json['i']}.should == [3,4,5,7]
|
117
123
|
end
|
118
124
|
|
119
125
|
it "removes those messages from the queue" do
|
@@ -124,8 +130,7 @@ describe 'Superbolt::Queue' do
|
|
124
130
|
end
|
125
131
|
|
126
132
|
describe 'errors cases' do
|
127
|
-
let(:new_queue) { Superbolt::Queue.new("
|
128
|
-
#{rand(1_000_000)}
|
133
|
+
let(:new_queue) { Superbolt::Queue.new("random.name.#{rand(1_000_000)}") }
|
129
134
|
|
130
135
|
after do
|
131
136
|
new_queue.clear
|
data/spec/superbolt_spec.rb
CHANGED
@@ -1,15 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Superbolt, 'the facade' do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
before do
|
5
|
+
Superbolt.instance_eval do
|
6
|
+
@config = nil
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'total configuration' do
|
11
|
+
before do
|
12
|
+
Superbolt.app_name = 'bossanova'
|
13
|
+
Superbolt.env = 'production'
|
14
|
+
Superbolt.config = {
|
15
|
+
connection_key: 'SOME_RABBITMQ_URL'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should retain the configuration information" do
|
20
|
+
Superbolt.config.app_name.should == 'bossanova'
|
21
|
+
Superbolt.config.env.should == 'production'
|
22
|
+
Superbolt.config.env_connection_key.should == 'SOME_RABBITMQ_URL'
|
9
23
|
end
|
24
|
+
end
|
10
25
|
|
11
|
-
|
12
|
-
|
26
|
+
describe '.config' do
|
27
|
+
it "has a default" do
|
28
|
+
Superbolt.config.should == Superbolt::Config.new({})
|
13
29
|
end
|
14
30
|
|
15
31
|
it "can be customized" do
|
data/superbolt.gemspec
CHANGED
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "activesupport"
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "amqp"
|
23
|
+
spec.add_dependency "bunny"
|
24
|
+
spec.add_dependency 'eventmachine'
|
23
25
|
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
27
|
spec.add_development_dependency "rake"
|
26
28
|
spec.add_development_dependency "rspec"
|
27
|
-
spec.add_development_dependency "eventmachine"
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superbolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- socialchorus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,41 +25,41 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: amqp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bunny
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: eventmachine
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
type: :
|
62
|
+
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
@@ -67,7 +67,21 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - '>='
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - '>='
|
@@ -108,6 +122,7 @@ files:
|
|
108
122
|
- README.md
|
109
123
|
- Rakefile
|
110
124
|
- lib/superbolt.rb
|
125
|
+
- lib/superbolt/adapter/amqp.rb
|
111
126
|
- lib/superbolt/adapter/base.rb
|
112
127
|
- lib/superbolt/adapter/bunny.rb
|
113
128
|
- lib/superbolt/app.rb
|
@@ -151,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
166
|
version: '0'
|
152
167
|
requirements: []
|
153
168
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.0.
|
169
|
+
rubygems_version: 2.0.14
|
155
170
|
signing_key:
|
156
171
|
specification_version: 4
|
157
172
|
summary: Superbolt is a gem that makes SOA intra-app communication easy, via RabbitMQ
|