carrot-top 0.0.5 → 0.0.6.beta
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.
- data/.travis.yml +3 -0
- data/README.org +43 -11
- data/Rakefile +3 -3
- data/carrot-top.gemspec +2 -3
- data/lib/carrot-top.rb +11 -9
- metadata +80 -48
- data/test/carrot-top_test.rb +0 -25
data/.travis.yml
ADDED
data/README.org
CHANGED
@@ -1,27 +1,59 @@
|
|
1
|
-
|
1
|
+
[[https://secure.travis-ci.org/portertech/carrot-top.png]]
|
2
|
+
|
3
|
+
* Install
|
4
|
+
|
2
5
|
: gem install carrot-top
|
6
|
+
|
3
7
|
* Usage
|
8
|
+
|
4
9
|
: require "carrot-top"
|
5
|
-
:
|
10
|
+
:
|
11
|
+
: carrot_top = CarrotTop.new(
|
12
|
+
: :host => "localhost",
|
13
|
+
: :port => 55672,
|
14
|
+
: :user => "user",
|
15
|
+
: :password => "password"
|
16
|
+
: )
|
17
|
+
|
6
18
|
Various random bits of information that describe the whole system.
|
7
|
-
|
19
|
+
|
20
|
+
: carrot_top.overview
|
21
|
+
|
8
22
|
A list of all open connections.
|
9
|
-
|
23
|
+
|
24
|
+
: carrot_top.connections
|
25
|
+
|
10
26
|
A list of all open channels.
|
11
|
-
|
27
|
+
|
28
|
+
: carrot_top.channels
|
29
|
+
|
12
30
|
A list of all exchanges.
|
13
|
-
|
31
|
+
|
32
|
+
: carrot_top.exchanges
|
33
|
+
|
14
34
|
A list of all queues.
|
15
|
-
|
35
|
+
|
36
|
+
: carrot_top.queues
|
37
|
+
|
16
38
|
A list of all bindings.
|
17
|
-
|
39
|
+
|
40
|
+
: carrot_top.bindings
|
41
|
+
|
18
42
|
A list of all vhosts.
|
19
|
-
|
43
|
+
|
44
|
+
: carrot_top.vhosts
|
45
|
+
|
20
46
|
A list of all users.
|
21
|
-
|
47
|
+
|
48
|
+
: carrot_top.users
|
49
|
+
|
22
50
|
A list of all permissions for all users.
|
23
|
-
|
51
|
+
|
52
|
+
: carrot_top.permissions
|
53
|
+
|
24
54
|
* License
|
25
55
|
Carrot-Top is released under the [[https://raw.github.com/portertech/carrot-top/master/MIT-LICENSE.txt][MIT license]].
|
56
|
+
|
26
57
|
* Nothing to do with this guy
|
58
|
+
|
27
59
|
[[https://github.com/portertech/carrot-top/raw/master/carrot-top.jpg]]
|
data/Rakefile
CHANGED
data/carrot-top.gemspec
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
$:.push File.expand_path("../lib", __FILE__)
|
3
2
|
|
4
3
|
Gem::Specification.new do |s|
|
5
4
|
s.name = "carrot-top"
|
6
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.6.beta"
|
7
6
|
s.authors = ["Sean Porter"]
|
8
7
|
s.email = ["portertech@gmail.com"]
|
9
8
|
s.homepage = "https://github.com/portertech/carrot-top"
|
@@ -17,6 +16,6 @@ Gem::Specification.new do |s|
|
|
17
16
|
s.require_paths = ["lib"]
|
18
17
|
|
19
18
|
s.add_dependency "json"
|
20
|
-
s.add_development_dependency "
|
19
|
+
s.add_development_dependency "rake"
|
21
20
|
s.add_development_dependency "webmock"
|
22
21
|
end
|
data/lib/carrot-top.rb
CHANGED
@@ -1,31 +1,33 @@
|
|
1
|
-
require "rubygems"
|
1
|
+
require "rubygems"
|
2
2
|
require "net/http"
|
3
|
+
require "net/https"
|
3
4
|
require "uri"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
class CarrotTop
|
8
|
+
attr_reader :rabbitmq_api
|
9
|
+
|
7
10
|
def initialize(options={})
|
8
11
|
[:host, :port, :user, :password].each do |option|
|
9
|
-
raise "You must supply a RabbitMQ management #{option}" if options[option].nil?
|
12
|
+
raise "You must supply a RabbitMQ management API #{option}" if options[option].nil?
|
10
13
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@
|
15
|
-
@password = options[:password]
|
14
|
+
protocol = options[:ssl] ? "https" : "http"
|
15
|
+
credentials = "#{options[:user]}:#{options[:password]}"
|
16
|
+
location = "#{options[:host]}:#{options[:port]}"
|
17
|
+
@rabbitmq_api = "#{protocol}://#{credentials}@#{location}/api"
|
16
18
|
end
|
17
19
|
|
18
20
|
def query_api(options={})
|
19
21
|
raise "You must supply an API path" if options[:path].nil?
|
20
22
|
uri = URI.parse(@rabbitmq_api + options[:path])
|
21
23
|
http = Net::HTTP.new(uri.host, uri.port)
|
22
|
-
if
|
24
|
+
if uri.scheme == "https"
|
23
25
|
http.use_ssl = true
|
24
26
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
25
27
|
end
|
26
28
|
request = Net::HTTP::Get.new(uri.request_uri)
|
27
29
|
request.add_field("content-type", "application/json")
|
28
|
-
request.basic_auth(
|
30
|
+
request.basic_auth(uri.user, uri.password)
|
29
31
|
http.request(request)
|
30
32
|
end
|
31
33
|
|
metadata
CHANGED
@@ -1,87 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrot-top
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1775080236
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
- beta
|
11
|
+
version: 0.0.6.beta
|
6
12
|
platform: ruby
|
7
|
-
authors:
|
13
|
+
authors:
|
8
14
|
- Sean Porter
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
|
19
|
+
date: 2012-10-13 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
15
23
|
name: json
|
16
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
26
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
22
34
|
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
23
38
|
prerelease: false
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: minitest
|
27
|
-
requirement: &70110001809100 !ruby/object:Gem::Requirement
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
40
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
33
48
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
37
51
|
name: webmock
|
38
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
54
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
44
62
|
type: :development
|
45
|
-
|
46
|
-
version_requirements: *70110001806840
|
63
|
+
version_requirements: *id003
|
47
64
|
description: A Ruby library for querying the RabbitMQ Management API
|
48
|
-
email:
|
65
|
+
email:
|
49
66
|
- portertech@gmail.com
|
50
67
|
executables: []
|
68
|
+
|
51
69
|
extensions: []
|
70
|
+
|
52
71
|
extra_rdoc_files: []
|
53
|
-
|
72
|
+
|
73
|
+
files:
|
54
74
|
- .gitignore
|
75
|
+
- .travis.yml
|
55
76
|
- Gemfile
|
56
77
|
- MIT-LICENSE.txt
|
57
78
|
- README.org
|
58
79
|
- Rakefile
|
59
80
|
- carrot-top.gemspec
|
60
81
|
- lib/carrot-top.rb
|
61
|
-
|
82
|
+
has_rdoc: true
|
62
83
|
homepage: https://github.com/portertech/carrot-top
|
63
84
|
licenses: []
|
85
|
+
|
64
86
|
post_install_message:
|
65
87
|
rdoc_options: []
|
66
|
-
|
88
|
+
|
89
|
+
require_paths:
|
67
90
|
- lib
|
68
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
92
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
101
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
102
|
+
requirements:
|
103
|
+
- - ">"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 25
|
106
|
+
segments:
|
107
|
+
- 1
|
108
|
+
- 3
|
109
|
+
- 1
|
110
|
+
version: 1.3.1
|
80
111
|
requirements: []
|
112
|
+
|
81
113
|
rubyforge_project: carrot-top
|
82
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.3.7
|
83
115
|
signing_key:
|
84
116
|
specification_version: 3
|
85
117
|
summary: A Ruby library for querying the RabbitMQ Management API
|
86
|
-
test_files:
|
87
|
-
|
118
|
+
test_files: []
|
119
|
+
|
data/test/carrot-top_test.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
$: << "#{File.dirname(__FILE__)}/../lib" unless $:.include?("#{File.dirname(__FILE__)}/../lib/")
|
2
|
-
require "rubygems" if RUBY_VERSION < "1.9.0"
|
3
|
-
gem "minitest"
|
4
|
-
require "minitest/autorun"
|
5
|
-
require "webmock/minitest"
|
6
|
-
require "carrot-top"
|
7
|
-
|
8
|
-
class TestCarrotTop < MiniTest::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
stub_request(:get, /.*user:password@localhost:55672.*/).
|
11
|
-
with(:headers => {'content-type'=>'application/json'}).
|
12
|
-
to_return(:status => 200, :body => '{"status": "success"}', :headers => {'content-type'=>'application/json'})
|
13
|
-
@rabbitmq_info = CarrotTop.new(:host => "localhost", :port => 55672, :user => "user", :password => "password")
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_channels
|
17
|
-
response = @rabbitmq_info.channels
|
18
|
-
assert response["status"] == "success"
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_queues
|
22
|
-
response = @rabbitmq_info.queues
|
23
|
-
assert response["status"] == "success"
|
24
|
-
end
|
25
|
-
end
|