dripdrop 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/dripdrop.gemspec +55 -63
- data/lib/dripdrop/handlers/http_client.rb +38 -0
- data/lib/dripdrop/handlers/{http.rb → http_server.rb} +0 -39
- data/lib/dripdrop/node.rb +9 -1
- metadata +14 -62
- data/.gitignore +0 -27
data/Rakefile
CHANGED
@@ -13,9 +13,7 @@ begin
|
|
13
13
|
gem.add_dependency('ffi-rzmq', '>= 0.7.1')
|
14
14
|
gem.add_dependency('eventmachine', '>= 0.12.10')
|
15
15
|
gem.add_dependency('em-websocket')
|
16
|
-
gem.add_dependency('eventmachine_httpserver')
|
17
16
|
gem.add_dependency('em-zeromq', '>= 0.1.2')
|
18
|
-
gem.add_dependency('yajl-ruby')
|
19
17
|
end
|
20
18
|
Jeweler::GemcutterTasks.new
|
21
19
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.10
|
data/dripdrop.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dripdrop}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cholakian"]
|
@@ -14,97 +14,89 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{andrew@andrewvc.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
21
|
+
"LICENSE",
|
22
|
+
"README.md",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"doc_img/topology.png",
|
26
|
+
"dripdrop.gemspec",
|
27
|
+
"example/agent_test.rb",
|
28
|
+
"example/combined.rb",
|
29
|
+
"example/complex/README",
|
30
|
+
"example/complex/client.rb",
|
31
|
+
"example/complex/server.rb",
|
32
|
+
"example/complex/service.rb",
|
33
|
+
"example/complex/websocket.rb",
|
34
|
+
"example/http.rb",
|
35
|
+
"example/pubsub.rb",
|
36
|
+
"example/pushpull.rb",
|
37
|
+
"example/subclass.rb",
|
38
|
+
"example/xreq_xrep.rb",
|
39
|
+
"js/dripdrop.html",
|
40
|
+
"js/dripdrop.js",
|
41
|
+
"js/qunit.css",
|
42
|
+
"js/qunit.js",
|
43
|
+
"lib/dripdrop.rb",
|
44
|
+
"lib/dripdrop/agent.rb",
|
45
|
+
"lib/dripdrop/handlers/base.rb",
|
46
|
+
"lib/dripdrop/handlers/http_client.rb",
|
47
|
+
"lib/dripdrop/handlers/http_server.rb",
|
48
|
+
"lib/dripdrop/handlers/websockets.rb",
|
49
|
+
"lib/dripdrop/handlers/zeromq.rb",
|
50
|
+
"lib/dripdrop/message.rb",
|
51
|
+
"lib/dripdrop/node.rb",
|
52
|
+
"lib/dripdrop/node/nodelet.rb",
|
53
|
+
"spec/gimite-websocket.rb",
|
54
|
+
"spec/message_spec.rb",
|
55
|
+
"spec/node/http_spec.rb",
|
56
|
+
"spec/node/nodelet_spec.rb",
|
57
|
+
"spec/node/routing_spec.rb",
|
58
|
+
"spec/node/websocket_spec.rb",
|
59
|
+
"spec/node/zmq_pushpull_spec.rb",
|
60
|
+
"spec/node/zmq_xrepxreq_spec.rb",
|
61
|
+
"spec/node_spec.rb",
|
62
|
+
"spec/spec_helper.rb"
|
63
63
|
]
|
64
64
|
s.homepage = %q{http://github.com/andrewvc/dripdrop}
|
65
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
66
65
|
s.require_paths = ["lib"]
|
67
|
-
s.rubygems_version = %q{1.
|
66
|
+
s.rubygems_version = %q{1.5.1}
|
68
67
|
s.summary = %q{Evented framework for ZeroMQ and EventMachine Apps.}
|
69
68
|
s.test_files = [
|
69
|
+
"spec/gimite-websocket.rb",
|
70
|
+
"spec/message_spec.rb",
|
71
|
+
"spec/node/http_spec.rb",
|
72
|
+
"spec/node/nodelet_spec.rb",
|
73
|
+
"spec/node/routing_spec.rb",
|
74
|
+
"spec/node/websocket_spec.rb",
|
75
|
+
"spec/node/zmq_pushpull_spec.rb",
|
76
|
+
"spec/node/zmq_xrepxreq_spec.rb",
|
70
77
|
"spec/node_spec.rb",
|
71
|
-
|
72
|
-
"spec/gimite-websocket.rb",
|
73
|
-
"spec/message_spec.rb",
|
74
|
-
"spec/node/nodelet_spec.rb",
|
75
|
-
"spec/node/zmq_pushpull_spec.rb",
|
76
|
-
"spec/node/zmq_xrepxreq_spec.rb",
|
77
|
-
"spec/node/routing_spec.rb",
|
78
|
-
"spec/node/websocket_spec.rb",
|
79
|
-
"spec/node/http_spec.rb"
|
78
|
+
"spec/spec_helper.rb"
|
80
79
|
]
|
81
80
|
|
82
81
|
if s.respond_to? :specification_version then
|
83
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
84
82
|
s.specification_version = 3
|
85
83
|
|
86
84
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
87
85
|
s.add_runtime_dependency(%q<ffi-rzmq>, [">= 0.7.1"])
|
88
86
|
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
|
89
87
|
s.add_runtime_dependency(%q<em-websocket>, [">= 0"])
|
90
|
-
s.add_runtime_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
91
88
|
s.add_runtime_dependency(%q<em-zeromq>, [">= 0.1.2"])
|
92
|
-
s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
|
93
89
|
else
|
94
90
|
s.add_dependency(%q<ffi-rzmq>, [">= 0.7.1"])
|
95
91
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
96
92
|
s.add_dependency(%q<em-websocket>, [">= 0"])
|
97
|
-
s.add_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
98
93
|
s.add_dependency(%q<em-zeromq>, [">= 0.1.2"])
|
99
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
100
94
|
end
|
101
95
|
else
|
102
96
|
s.add_dependency(%q<ffi-rzmq>, [">= 0.7.1"])
|
103
97
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
104
98
|
s.add_dependency(%q<em-websocket>, [">= 0"])
|
105
|
-
s.add_dependency(%q<eventmachine_httpserver>, [">= 0"])
|
106
99
|
s.add_dependency(%q<em-zeromq>, [">= 0.1.2"])
|
107
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
108
100
|
end
|
109
101
|
end
|
110
102
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class DripDrop
|
2
|
+
class HTTPClientHandler < BaseHandler
|
3
|
+
attr_reader :address, :opts
|
4
|
+
|
5
|
+
def initialize(uri, opts={})
|
6
|
+
@uri = uri
|
7
|
+
@address = @uri.to_s
|
8
|
+
@opts = opts
|
9
|
+
@message_class = @opts[:message_class] || DripDrop.default_message_class
|
10
|
+
end
|
11
|
+
|
12
|
+
def send_message(message,&block)
|
13
|
+
dd_message = dd_messagify(message)
|
14
|
+
if dd_message.is_a?(DripDrop::Message)
|
15
|
+
uri_path = @uri.path.empty? ? '/' : @uri.path
|
16
|
+
|
17
|
+
req = EM::Protocols::HttpClient.request(
|
18
|
+
:host => @uri.host, :port => @uri.port,
|
19
|
+
:request => uri_path, :verb => 'POST',
|
20
|
+
:contenttype => 'application/json',
|
21
|
+
:content => dd_message.encode_json
|
22
|
+
)
|
23
|
+
req.callback do |response|
|
24
|
+
begin
|
25
|
+
# Hack to fix evma http
|
26
|
+
response[:content] =~ /(\{.*\})/
|
27
|
+
fixed_body = $1
|
28
|
+
block.call(@message_class.decode(fixed_body)) if block
|
29
|
+
rescue StandardError => e
|
30
|
+
handle_error(e)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
34
|
+
raise "Unsupported message type '#{dd_message.class}'"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'eventmachine'
|
2
1
|
require 'evma_httpserver'
|
3
2
|
|
4
3
|
class DripDrop
|
@@ -57,42 +56,4 @@ class DripDrop
|
|
57
56
|
self
|
58
57
|
end
|
59
58
|
end
|
60
|
-
|
61
|
-
|
62
|
-
class HTTPClientHandler < BaseHandler
|
63
|
-
attr_reader :address, :opts
|
64
|
-
|
65
|
-
def initialize(uri, opts={})
|
66
|
-
@uri = uri
|
67
|
-
@address = @uri.to_s
|
68
|
-
@opts = opts
|
69
|
-
@message_class = @opts[:message_class] || DripDrop.default_message_class
|
70
|
-
end
|
71
|
-
|
72
|
-
def send_message(message,&block)
|
73
|
-
dd_message = dd_messagify(message)
|
74
|
-
if dd_message.is_a?(DripDrop::Message)
|
75
|
-
uri_path = @uri.path.empty? ? '/' : @uri.path
|
76
|
-
|
77
|
-
req = EM::Protocols::HttpClient.request(
|
78
|
-
:host => @uri.host, :port => @uri.port,
|
79
|
-
:request => uri_path, :verb => 'POST',
|
80
|
-
:contenttype => 'application/json',
|
81
|
-
:content => dd_message.encode_json
|
82
|
-
)
|
83
|
-
req.callback do |response|
|
84
|
-
begin
|
85
|
-
# Hack to fix evma http
|
86
|
-
response[:content] =~ /(\{.*\})/
|
87
|
-
fixed_body = $1
|
88
|
-
block.call(@message_class.decode(fixed_body)) if block
|
89
|
-
rescue StandardError => e
|
90
|
-
handle_error(e)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
else
|
94
|
-
raise "Unsupported message type '#{dd_message.class}'"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
59
|
end
|
data/lib/dripdrop/node.rb
CHANGED
@@ -10,7 +10,15 @@ require 'dripdrop/node/nodelet'
|
|
10
10
|
require 'dripdrop/handlers/base'
|
11
11
|
require 'dripdrop/handlers/zeromq'
|
12
12
|
require 'dripdrop/handlers/websockets'
|
13
|
-
require 'dripdrop/handlers/
|
13
|
+
require 'dripdrop/handlers/http_client'
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'dripdrop/handlers/http_server'
|
17
|
+
rescue LoadError => e
|
18
|
+
$stderr.write "Could not load http server, your probably don't have eventmachine_httpserver installed\n"
|
19
|
+
$stderr.write e.message + "\n"
|
20
|
+
$stderr.write e.backtrace.join("\t\n")
|
21
|
+
end
|
14
22
|
|
15
23
|
class DripDrop
|
16
24
|
class Node
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dripdrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 9
|
9
|
-
version: 0.9.9
|
4
|
+
prerelease:
|
5
|
+
version: 0.9.10
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Andrew Cholakian
|
@@ -25,10 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 7
|
31
|
-
- 1
|
32
24
|
version: 0.7.1
|
33
25
|
type: :runtime
|
34
26
|
version_requirements: *id001
|
@@ -40,10 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
- 12
|
46
|
-
- 10
|
47
35
|
version: 0.12.10
|
48
36
|
type: :runtime
|
49
37
|
version_requirements: *id002
|
@@ -55,52 +43,20 @@ dependencies:
|
|
55
43
|
requirements:
|
56
44
|
- - ">="
|
57
45
|
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
46
|
version: "0"
|
61
47
|
type: :runtime
|
62
48
|
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: eventmachine_httpserver
|
65
|
-
prerelease: false
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
segments:
|
72
|
-
- 0
|
73
|
-
version: "0"
|
74
|
-
type: :runtime
|
75
|
-
version_requirements: *id004
|
76
49
|
- !ruby/object:Gem::Dependency
|
77
50
|
name: em-zeromq
|
78
51
|
prerelease: false
|
79
|
-
requirement: &
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
80
53
|
none: false
|
81
54
|
requirements:
|
82
55
|
- - ">="
|
83
56
|
- !ruby/object:Gem::Version
|
84
|
-
segments:
|
85
|
-
- 0
|
86
|
-
- 1
|
87
|
-
- 2
|
88
57
|
version: 0.1.2
|
89
58
|
type: :runtime
|
90
|
-
version_requirements: *
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: yajl-ruby
|
93
|
-
prerelease: false
|
94
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
version: "0"
|
102
|
-
type: :runtime
|
103
|
-
version_requirements: *id006
|
59
|
+
version_requirements: *id004
|
104
60
|
description: "Evented framework for ZeroMQ and EventMachine Apps. "
|
105
61
|
email: andrew@andrewvc.com
|
106
62
|
executables: []
|
@@ -112,7 +68,6 @@ extra_rdoc_files:
|
|
112
68
|
- README.md
|
113
69
|
files:
|
114
70
|
- .document
|
115
|
-
- .gitignore
|
116
71
|
- LICENSE
|
117
72
|
- README.md
|
118
73
|
- Rakefile
|
@@ -138,7 +93,8 @@ files:
|
|
138
93
|
- lib/dripdrop.rb
|
139
94
|
- lib/dripdrop/agent.rb
|
140
95
|
- lib/dripdrop/handlers/base.rb
|
141
|
-
- lib/dripdrop/handlers/
|
96
|
+
- lib/dripdrop/handlers/http_client.rb
|
97
|
+
- lib/dripdrop/handlers/http_server.rb
|
142
98
|
- lib/dripdrop/handlers/websockets.rb
|
143
99
|
- lib/dripdrop/handlers/zeromq.rb
|
144
100
|
- lib/dripdrop/message.rb
|
@@ -159,8 +115,8 @@ homepage: http://github.com/andrewvc/dripdrop
|
|
159
115
|
licenses: []
|
160
116
|
|
161
117
|
post_install_message:
|
162
|
-
rdoc_options:
|
163
|
-
|
118
|
+
rdoc_options: []
|
119
|
+
|
164
120
|
require_paths:
|
165
121
|
- lib
|
166
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -168,32 +124,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
124
|
requirements:
|
169
125
|
- - ">="
|
170
126
|
- !ruby/object:Gem::Version
|
171
|
-
segments:
|
172
|
-
- 0
|
173
127
|
version: "0"
|
174
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
129
|
none: false
|
176
130
|
requirements:
|
177
131
|
- - ">="
|
178
132
|
- !ruby/object:Gem::Version
|
179
|
-
segments:
|
180
|
-
- 0
|
181
133
|
version: "0"
|
182
134
|
requirements: []
|
183
135
|
|
184
136
|
rubyforge_project:
|
185
|
-
rubygems_version: 1.
|
137
|
+
rubygems_version: 1.5.1
|
186
138
|
signing_key:
|
187
139
|
specification_version: 3
|
188
140
|
summary: Evented framework for ZeroMQ and EventMachine Apps.
|
189
141
|
test_files:
|
190
|
-
- spec/node_spec.rb
|
191
|
-
- spec/spec_helper.rb
|
192
142
|
- spec/gimite-websocket.rb
|
193
143
|
- spec/message_spec.rb
|
144
|
+
- spec/node/http_spec.rb
|
194
145
|
- spec/node/nodelet_spec.rb
|
195
|
-
- spec/node/zmq_pushpull_spec.rb
|
196
|
-
- spec/node/zmq_xrepxreq_spec.rb
|
197
146
|
- spec/node/routing_spec.rb
|
198
147
|
- spec/node/websocket_spec.rb
|
199
|
-
- spec/node/
|
148
|
+
- spec/node/zmq_pushpull_spec.rb
|
149
|
+
- spec/node/zmq_xrepxreq_spec.rb
|
150
|
+
- spec/node_spec.rb
|
151
|
+
- spec/spec_helper.rb
|
data/.gitignore
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
*.swo
|
16
|
-
*.swn
|
17
|
-
|
18
|
-
## PROJECT::GENERAL
|
19
|
-
coverage
|
20
|
-
rdoc
|
21
|
-
doc
|
22
|
-
pkg
|
23
|
-
|
24
|
-
#RBX
|
25
|
-
*.rbc
|
26
|
-
|
27
|
-
## PROJECT::SPECIFIC
|