euston-rabbitmq 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/euston-rabbitmq.gemspec +5 -5
- data/lib/euston-rabbitmq/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/filters.rb +1 -1
- metadata +37 -27
- data/spec/support/rabbitmqadmin.rb +0 -74
data/euston-rabbitmq.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'euston-rabbitmq'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.4'
|
4
4
|
s.platform = RUBY_PLATFORM.to_s == 'java' ? 'java' : Gem::Platform::RUBY
|
5
5
|
s.authors = ['Lee Henson', 'Guy Boertje']
|
6
6
|
s.email = ['lee.m.henson@gmail.com', 'guyboertje@gmail.com']
|
@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
|
|
38
38
|
spec/spec_helper.rb
|
39
39
|
spec/support/filters.rb
|
40
40
|
spec/support/queue_subscription_thread_harness.rb
|
41
|
-
spec/support/rabbitmqadmin.rb
|
42
41
|
]
|
43
42
|
# = MANIFEST =
|
44
43
|
|
@@ -59,7 +58,8 @@ Gem::Specification.new do |s|
|
|
59
58
|
s.add_dependency 'jessica', '~> 1.0.0'
|
60
59
|
end
|
61
60
|
|
62
|
-
s.add_development_dependency 'awesome_print',
|
63
|
-
s.add_development_dependency 'fuubar',
|
64
|
-
s.add_development_dependency '
|
61
|
+
s.add_development_dependency 'awesome_print', '~> 0.4.0'
|
62
|
+
s.add_development_dependency 'fuubar', '~> 0.0.0'
|
63
|
+
s.add_development_dependency 'rabbitmqadmin-cli', '~> 1.0.0'
|
64
|
+
s.add_development_dependency 'rspec', '~> 2.6.0'
|
65
65
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/filters.rb
CHANGED
@@ -4,7 +4,7 @@ def initialize_amqp
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def initialize_rabbitmq
|
7
|
-
@rabbitmqadmin =
|
7
|
+
@rabbitmqadmin = RabbitMqAdminCli.new
|
8
8
|
@rabbitmqadmin.initialize_vhost AMQP_OPTS[:vhost]
|
9
9
|
@rabbitmqadmin.initialize_user AMQP_OPTS[:vhost], AMQP_OPTS[:user], AMQP_OPTS[:pass]
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: euston-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &73298000 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *73298000
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: euston
|
28
|
-
requirement: &
|
28
|
+
requirement: &73297310 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *73297310
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: euston-eventstore
|
39
|
-
requirement: &
|
39
|
+
requirement: &73515570 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 1.0.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *73515570
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: hash-keys
|
50
|
-
requirement: &
|
50
|
+
requirement: &73514180 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 1.0.0
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *73514180
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: hollywood
|
61
|
-
requirement: &
|
61
|
+
requirement: &73511360 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 1.0.0
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *73511360
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: i18n
|
72
|
-
requirement: &
|
72
|
+
requirement: &73509800 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 0.5.0
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *73509800
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: require_all
|
83
|
-
requirement: &
|
83
|
+
requirement: &73572160 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.2.0
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *73572160
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: robustthread
|
94
|
-
requirement: &
|
94
|
+
requirement: &73571580 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 0.5.2
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *73571580
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: safely
|
105
|
-
requirement: &
|
105
|
+
requirement: &73570910 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: 0.3.0
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *73570910
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: awesome_print
|
116
|
-
requirement: &
|
116
|
+
requirement: &73569740 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ~>
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: 0.4.0
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *73569740
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fuubar
|
127
|
-
requirement: &
|
127
|
+
requirement: &73568940 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ~>
|
@@ -132,10 +132,21 @@ dependencies:
|
|
132
132
|
version: 0.0.0
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *73568940
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: rabbitmqadmin-cli
|
138
|
+
requirement: &73568080 !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ~>
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.0.0
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: *73568080
|
136
147
|
- !ruby/object:Gem::Dependency
|
137
148
|
name: rspec
|
138
|
-
requirement: &
|
149
|
+
requirement: &73567470 !ruby/object:Gem::Requirement
|
139
150
|
none: false
|
140
151
|
requirements:
|
141
152
|
- - ~>
|
@@ -143,7 +154,7 @@ dependencies:
|
|
143
154
|
version: 2.6.0
|
144
155
|
type: :development
|
145
156
|
prerelease: false
|
146
|
-
version_requirements: *
|
157
|
+
version_requirements: *73567470
|
147
158
|
description: JRuby RabbitMq bindings
|
148
159
|
email:
|
149
160
|
- lee.m.henson@gmail.com
|
@@ -180,7 +191,6 @@ files:
|
|
180
191
|
- spec/spec_helper.rb
|
181
192
|
- spec/support/filters.rb
|
182
193
|
- spec/support/queue_subscription_thread_harness.rb
|
183
|
-
- spec/support/rabbitmqadmin.rb
|
184
194
|
homepage: http://github.com/leemhenson/euston-rabbitmq
|
185
195
|
licenses: []
|
186
196
|
post_install_message:
|
@@ -1,74 +0,0 @@
|
|
1
|
-
class RabbitMqAdmin
|
2
|
-
def initialize admin_user = 'guest', admin_password = 'guest'
|
3
|
-
@admin_user = admin_user
|
4
|
-
@admin_password = admin_password
|
5
|
-
end
|
6
|
-
|
7
|
-
def delete_exchanges
|
8
|
-
list_exchanges.each { |exchange| `#{run vhost} delete exchange name=#{exchange[:name]}` }
|
9
|
-
end
|
10
|
-
|
11
|
-
def delete_queues
|
12
|
-
list_queues.each { |queue| `#{run vhost} delete queue name=#{queue[:name]}` }
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize_user vhost, user, password, tags = ''
|
16
|
-
`#{run} delete user name=#{user}` if user_exists? user
|
17
|
-
`#{run} declare user name=#{user} password=#{password} tags=#{tags}`
|
18
|
-
add_user_to_vhost vhost, user
|
19
|
-
end
|
20
|
-
|
21
|
-
def initialize_vhost vhost
|
22
|
-
`#{run} delete vhost name=#{vhost}` if vhost_exists? vhost
|
23
|
-
`#{run} declare vhost name=#{vhost}`
|
24
|
-
add_user_to_vhost vhost, @admin_user
|
25
|
-
end
|
26
|
-
|
27
|
-
def run vhost = nil
|
28
|
-
vhost_arg = vhost.nil? ? '' : "-V #{vhost}"
|
29
|
-
|
30
|
-
"rabbitmqadmin -u #{@admin_user} -p #{@admin_password} -f raw_json #{vhost_arg}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def list_bindings vhost
|
34
|
-
parse `#{run vhost} list bindings`
|
35
|
-
end
|
36
|
-
|
37
|
-
def list_exchanges vhost
|
38
|
-
parse `#{run vhost} list exchanges`
|
39
|
-
end
|
40
|
-
|
41
|
-
def list_queues vhost
|
42
|
-
parse `#{run vhost} list queues`
|
43
|
-
end
|
44
|
-
|
45
|
-
def list_users
|
46
|
-
parse `#{run} list users`
|
47
|
-
end
|
48
|
-
|
49
|
-
def list_vhosts
|
50
|
-
parse `#{run} list vhosts`
|
51
|
-
end
|
52
|
-
|
53
|
-
def purge_queues
|
54
|
-
list_queues.each { |queue| `#{run vhost} purge queue name=#{queue[:name]}` }
|
55
|
-
end
|
56
|
-
|
57
|
-
def user_exists? user
|
58
|
-
list_users.any? { |u| u[:name] == user }
|
59
|
-
end
|
60
|
-
|
61
|
-
def vhost_exists? vhost
|
62
|
-
list_vhosts.any? { |h| h[:name] == vhost }
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def parse json
|
68
|
-
JSON.parse json, :symbolize_names => true
|
69
|
-
end
|
70
|
-
|
71
|
-
def add_user_to_vhost vhost, user
|
72
|
-
`#{run} -V #{vhost} declare permission vhost=#{vhost} user=#{user} configure=\"\.\*\" write=\"\.\*\" read=\"\.\*\"`
|
73
|
-
end
|
74
|
-
end
|