rabbitmq-service-util 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/Gemfile.lock +16 -0
- data/LICENSE +19 -0
- data/README.md +26 -0
- data/Rakefile +31 -0
- data/lib/rabbitmq_service_util.rb +27 -0
- data/rabbitmq-service-util.gemspec +53 -0
- metadata +103 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 by VMware, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# rabbitmq-service-util
|
2
|
+
|
3
|
+
Utility code to obtain the RabbitMQ service connection information on
|
4
|
+
multiple PaaSes. The returned connection info can then be passed to
|
5
|
+
common Ruby AMQP client libraries, such as the
|
6
|
+
[amqp gem](https://github.com/ruby-amqp/amqp) or
|
7
|
+
[bunny gem](https://github.com/ruby-amqp/bunny)
|
8
|
+
|
9
|
+
Currently supports [Cloud Foundry](http://www.cloudfoundry.com) and
|
10
|
+
[Heroku](http://heroku.com).
|
11
|
+
|
12
|
+
## Getting started
|
13
|
+
|
14
|
+
Add the rubygem to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'rabbitmq-service-util'
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
require 'rabbitmq-service-util'
|
21
|
+
|
22
|
+
# If using the amqp gem
|
23
|
+
connection = AMQP.connect(RabbitMQ::amqp_connection_url)
|
24
|
+
|
25
|
+
# If using the bunny gem
|
26
|
+
connection = Bunny.new(RabbitMQ::amqp_connection_url)
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "rabbitmq-service-util"
|
17
|
+
gem.version = "0.1"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{Makes accessing the RabbitMQ service/add-on super easy}
|
20
|
+
gem.description = %Q{
|
21
|
+
Utility code to obtain the RabbitMQ service connection information on
|
22
|
+
multiple PaaSes. The returned connection info can then be passed to
|
23
|
+
common Ruby AMQP client libraries.
|
24
|
+
}
|
25
|
+
gem.email = "info@rabbitmq.com"
|
26
|
+
gem.authors = ["The RabbitMQ team at VMware"]
|
27
|
+
gem.homepage = "http://github.com/rabbitmq/rabbitmq-service-util"
|
28
|
+
gem.files = FileList["**/*"].exclude("*~")
|
29
|
+
gem.executables = FileList["bin/*"].pathmap("%f")
|
30
|
+
end
|
31
|
+
Jeweler::RubygemsDotOrgTasks.new
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RabbitMQ
|
2
|
+
# Obtain the AMQP connection URL for the RabbitMQ service instance
|
3
|
+
# for this app. This URL can be passed directly to recent versions
|
4
|
+
# onf the amqp and bunny gems.
|
5
|
+
def self.amqp_connection_url
|
6
|
+
cf_amqp_connection_url || heroku_amqp_connection_url
|
7
|
+
end
|
8
|
+
|
9
|
+
# Obtain the AMQP connection URL on Cloud Foundry
|
10
|
+
def self.cf_amqp_connection_url
|
11
|
+
services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)
|
12
|
+
url = services.values.map do |srvs|
|
13
|
+
srvs.map do |srv|
|
14
|
+
if srv[:label] =~ /^rabbitmq-/
|
15
|
+
srv[:credentials][:url]
|
16
|
+
else
|
17
|
+
[]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end.flatten!.first
|
21
|
+
end
|
22
|
+
|
23
|
+
# Obtain the AMQP connection URL on Heroku
|
24
|
+
def self.heroku_amqp_connection_url
|
25
|
+
ENV['RABBITMQ_URL']
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rabbitmq-service-util}
|
8
|
+
s.version = "0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = [%q{The RabbitMQ team at VMware}]
|
12
|
+
s.date = %q{2011-08-25}
|
13
|
+
s.description = %q{
|
14
|
+
Utility code to obtain the RabbitMQ service connection information on
|
15
|
+
multiple PaaSes. The returned connection info can then be passed to
|
16
|
+
common Ruby AMQP client libraries.
|
17
|
+
}
|
18
|
+
s.email = %q{info@rabbitmq.com}
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"LICENSE",
|
21
|
+
"README.md"
|
22
|
+
]
|
23
|
+
s.files = [
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE",
|
27
|
+
"README.md",
|
28
|
+
"Rakefile",
|
29
|
+
"lib/rabbitmq_service_util.rb",
|
30
|
+
"rabbitmq-service-util.gemspec"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/rabbitmq/rabbitmq-service-util}
|
33
|
+
s.licenses = [%q{MIT}]
|
34
|
+
s.require_paths = [%q{lib}]
|
35
|
+
s.rubygems_version = %q{1.8.6}
|
36
|
+
s.summary = %q{Makes accessing the RabbitMQ service/add-on super easy}
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
46
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
47
|
+
end
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
50
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rabbitmq-service-util
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- The RabbitMQ team at VMware
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-08-25 00:00:00 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
type: :development
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
version_requirements: *id001
|
31
|
+
name: jeweler
|
32
|
+
prerelease: false
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
type: :development
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
hash: 3
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
version_requirements: *id002
|
45
|
+
name: rake
|
46
|
+
prerelease: false
|
47
|
+
description: |
|
48
|
+
|
49
|
+
Utility code to obtain the RabbitMQ service connection information on
|
50
|
+
multiple PaaSes. The returned connection info can then be passed to
|
51
|
+
common Ruby AMQP client libraries.
|
52
|
+
|
53
|
+
email: info@rabbitmq.com
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files:
|
59
|
+
- LICENSE
|
60
|
+
- README.md
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/rabbitmq_service_util.rb
|
68
|
+
- rabbitmq-service-util.gemspec
|
69
|
+
homepage: http://github.com/rabbitmq/rabbitmq-service-util
|
70
|
+
licenses:
|
71
|
+
- MIT
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
requirements: []
|
96
|
+
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 1.8.6
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Makes accessing the RabbitMQ service/add-on super easy
|
102
|
+
test_files: []
|
103
|
+
|