secure_carrot 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/test/test_helper.rb +1 -1
- metadata +3 -4
- data/lib/carrot.rb +0 -92
data/VERSION.yml
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secure_carrot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sriram Varahan
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- lib/amqp/queue.rb
|
56
56
|
- lib/amqp/server.rb
|
57
57
|
- lib/amqp/spec.rb
|
58
|
-
- lib/carrot.rb
|
59
58
|
- lib/examples/simple_pop.rb
|
60
59
|
- protocol/amqp-0.8.json
|
61
60
|
- protocol/amqp-0.8.xml
|
data/lib/carrot.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
class Carrot
|
2
|
-
module AMQP
|
3
|
-
HEADER = "AMQP".freeze
|
4
|
-
VERSION_MAJOR = 8
|
5
|
-
VERSION_MINOR = 0
|
6
|
-
PORT = 5672
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
$:.unshift File.expand_path(File.dirname(File.expand_path(__FILE__)))
|
11
|
-
require 'amqp/spec'
|
12
|
-
require 'amqp/buffer'
|
13
|
-
require 'amqp/exchange'
|
14
|
-
require 'amqp/frame'
|
15
|
-
require 'amqp/header'
|
16
|
-
require 'amqp/queue'
|
17
|
-
require 'amqp/server'
|
18
|
-
require 'amqp/protocol'
|
19
|
-
require 'encrypted_strings'
|
20
|
-
|
21
|
-
class Carrot
|
22
|
-
@logging = false
|
23
|
-
class << self
|
24
|
-
attr_accessor :logging
|
25
|
-
end
|
26
|
-
def self.logging?
|
27
|
-
@logging
|
28
|
-
end
|
29
|
-
class Error < StandardError; end
|
30
|
-
|
31
|
-
def initialize(opts = {})
|
32
|
-
@opts = opts
|
33
|
-
end
|
34
|
-
|
35
|
-
def queue(name, opts = {})
|
36
|
-
queues[name] ||= AMQP::Queue.new(self, name, opts)
|
37
|
-
end
|
38
|
-
|
39
|
-
def server
|
40
|
-
@server ||= AMQP::Server.new(@opts)
|
41
|
-
end
|
42
|
-
|
43
|
-
def stop
|
44
|
-
server.close
|
45
|
-
@server = nil
|
46
|
-
end
|
47
|
-
alias :reset :stop
|
48
|
-
|
49
|
-
def queues
|
50
|
-
@queues ||= {}
|
51
|
-
end
|
52
|
-
|
53
|
-
def direct(name = 'amq.direct', opts = {})
|
54
|
-
exchanges[name] ||= AMQP::Exchange.new(self, :direct, name, opts)
|
55
|
-
end
|
56
|
-
|
57
|
-
def topic(name = 'amq.topic', opts = {})
|
58
|
-
exchanges[name] ||= AMQP::Exchange.new(self, :topic, name, opts)
|
59
|
-
end
|
60
|
-
|
61
|
-
def headers(name = 'amq.match', opts = {})
|
62
|
-
exchanges[name] ||= AMQP::Exchange.new(self, :headers, name, opts)
|
63
|
-
end
|
64
|
-
|
65
|
-
def exchanges
|
66
|
-
@exchanges ||= {}
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def log(*args)
|
72
|
-
return unless Carrot.logging?
|
73
|
-
pp args
|
74
|
-
puts
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
#-- convenience wrapper (read: HACK) for thread-local Carrot object
|
79
|
-
|
80
|
-
class Carrot
|
81
|
-
def Carrot.default
|
82
|
-
#-- XXX clear this when connection is closed
|
83
|
-
Thread.current[:carrot] ||= Carrot.new
|
84
|
-
end
|
85
|
-
|
86
|
-
# Allows for calls to all Carrot instance methods. This implicitly calls
|
87
|
-
# Carrot.new so that a new channel is allocated for subsequent operations.
|
88
|
-
def Carrot.method_missing(meth, *args, &blk)
|
89
|
-
Carrot.default.__send__(meth, *args, &blk)
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|