rabbitmq-service-util 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/rabbitmq_service_util.rb +14 -9
- data/rabbitmq-service-util.gemspec +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ require 'jeweler'
|
|
14
14
|
Jeweler::Tasks.new do |gem|
|
15
15
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
16
|
gem.name = "rabbitmq-service-util"
|
17
|
-
gem.version = "0.
|
17
|
+
gem.version = "0.2"
|
18
18
|
gem.license = "MIT"
|
19
19
|
gem.summary = %Q{Makes accessing the RabbitMQ service/add-on super easy}
|
20
20
|
gem.description = %Q{
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module RabbitMQ
|
2
4
|
# Obtain the AMQP connection URL for the RabbitMQ service instance
|
3
5
|
# for this app. This URL can be passed directly to recent versions
|
@@ -8,16 +10,19 @@ module RabbitMQ
|
|
8
10
|
|
9
11
|
# Obtain the AMQP connection URL on Cloud Foundry
|
10
12
|
def self.cf_amqp_connection_url
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
services_env = ENV['VCAP_SERVICES']
|
14
|
+
if services_env
|
15
|
+
services = JSON.parse(services_env, :symbolize_names => true)
|
16
|
+
url = services.values.map do |srvs|
|
17
|
+
srvs.map do |srv|
|
18
|
+
if srv[:label] =~ /^rabbitmq-/
|
19
|
+
srv[:credentials][:url]
|
20
|
+
else
|
21
|
+
[]
|
22
|
+
end
|
18
23
|
end
|
19
|
-
end
|
20
|
-
end
|
24
|
+
end.flatten!.first
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
# Obtain the AMQP connection URL on Heroku
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rabbitmq-service-util}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{The RabbitMQ team at VMware}]
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbitmq-service-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- The RabbitMQ team at VMware
|