hutch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +18 -0
- data/Guardfile +5 -0
- data/README.md +136 -0
- data/Rakefile +14 -0
- data/bin/hutch +8 -0
- data/circle.yml +3 -0
- data/examples/consumer.rb +13 -0
- data/examples/producer.rb +10 -0
- data/hutch.gemspec +22 -0
- data/lib/hutch.rb +40 -0
- data/lib/hutch/broker.rb +175 -0
- data/lib/hutch/cli.rb +151 -0
- data/lib/hutch/config.rb +66 -0
- data/lib/hutch/consumer.rb +33 -0
- data/lib/hutch/error_handlers/logger.rb +16 -0
- data/lib/hutch/error_handlers/sentry.rb +23 -0
- data/lib/hutch/exceptions.rb +5 -0
- data/lib/hutch/logging.rb +32 -0
- data/lib/hutch/message.rb +26 -0
- data/lib/hutch/version.rb +4 -0
- data/lib/hutch/worker.rb +104 -0
- data/spec/hutch/broker_spec.rb +157 -0
- data/spec/hutch/config_spec.rb +69 -0
- data/spec/hutch/consumer_spec.rb +80 -0
- data/spec/hutch/error_handlers/logger_spec.rb +15 -0
- data/spec/hutch/error_handlers/sentry_spec.rb +20 -0
- data/spec/hutch/logger_spec.rb +28 -0
- data/spec/hutch/message_spec.rb +35 -0
- data/spec/hutch/worker_spec.rb +80 -0
- data/spec/hutch_spec.rb +16 -0
- data/spec/spec_helper.rb +23 -0
- metadata +144 -0
data/spec/hutch_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hutch do
|
4
|
+
describe '.register_consumer' do
|
5
|
+
let(:consumer_a) { double('Consumer') }
|
6
|
+
let(:consumer_b) { double('Consumer') }
|
7
|
+
|
8
|
+
it 'saves the consumers in the global consumer list' do
|
9
|
+
Hutch.register_consumer(consumer_a)
|
10
|
+
Hutch.register_consumer(consumer_b)
|
11
|
+
Hutch.consumers.should include consumer_a
|
12
|
+
Hutch.consumers.should include consumer_b
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'raven'
|
2
|
+
require 'hutch'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.before(:all) { Hutch::Config.log_level = Logger::FATAL }
|
7
|
+
end
|
8
|
+
|
9
|
+
# Constants (classes, etc) defined within a block passed to this method
|
10
|
+
# will be removed from the global namespace after the block as run.
|
11
|
+
def isolate_constants
|
12
|
+
existing_constants = Object.constants
|
13
|
+
yield
|
14
|
+
ensure
|
15
|
+
(Object.constants - existing_constants).each do |constant|
|
16
|
+
Object.send(:remove_const, constant)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def deep_copy(obj)
|
21
|
+
Marshal.load(Marshal.dump(obj))
|
22
|
+
end
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hutch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harry Marr
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bunny
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carrot-top
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.12.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.12.0
|
69
|
+
description: Hutch is a Ruby library for enabling asynchronous inter-service communication
|
70
|
+
using RabbitMQ.
|
71
|
+
email:
|
72
|
+
- developers@gocardless.com
|
73
|
+
executables:
|
74
|
+
- hutch
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- Gemfile
|
80
|
+
- Guardfile
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/hutch
|
84
|
+
- circle.yml
|
85
|
+
- examples/consumer.rb
|
86
|
+
- examples/producer.rb
|
87
|
+
- hutch.gemspec
|
88
|
+
- lib/hutch.rb
|
89
|
+
- lib/hutch/broker.rb
|
90
|
+
- lib/hutch/cli.rb
|
91
|
+
- lib/hutch/config.rb
|
92
|
+
- lib/hutch/consumer.rb
|
93
|
+
- lib/hutch/error_handlers/logger.rb
|
94
|
+
- lib/hutch/error_handlers/sentry.rb
|
95
|
+
- lib/hutch/exceptions.rb
|
96
|
+
- lib/hutch/logging.rb
|
97
|
+
- lib/hutch/message.rb
|
98
|
+
- lib/hutch/version.rb
|
99
|
+
- lib/hutch/worker.rb
|
100
|
+
- spec/hutch/broker_spec.rb
|
101
|
+
- spec/hutch/config_spec.rb
|
102
|
+
- spec/hutch/consumer_spec.rb
|
103
|
+
- spec/hutch/error_handlers/logger_spec.rb
|
104
|
+
- spec/hutch/error_handlers/sentry_spec.rb
|
105
|
+
- spec/hutch/logger_spec.rb
|
106
|
+
- spec/hutch/message_spec.rb
|
107
|
+
- spec/hutch/worker_spec.rb
|
108
|
+
- spec/hutch_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
homepage: https://github.com/gocardless/hutch
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.0.3
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Easy inter-service communication using RabbitMQ.
|
134
|
+
test_files:
|
135
|
+
- spec/hutch/broker_spec.rb
|
136
|
+
- spec/hutch/config_spec.rb
|
137
|
+
- spec/hutch/consumer_spec.rb
|
138
|
+
- spec/hutch/error_handlers/logger_spec.rb
|
139
|
+
- spec/hutch/error_handlers/sentry_spec.rb
|
140
|
+
- spec/hutch/logger_spec.rb
|
141
|
+
- spec/hutch/message_spec.rb
|
142
|
+
- spec/hutch/worker_spec.rb
|
143
|
+
- spec/hutch_spec.rb
|
144
|
+
- spec/spec_helper.rb
|