protobuf 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/protobuf.rb +6 -2
- data/lib/protobuf/rpc/connector.rb +2 -2
- data/lib/protobuf/version.rb +1 -1
- data/spec/benchmark/tasks.rb +2 -2
- data/spec/unit/rpc/connector_spec.rb +2 -2
- data/spec/unit/rpc/servers/socket_server_spec.rb +1 -1
- metadata +18 -18
data/Gemfile.lock
CHANGED
data/lib/protobuf.rb
CHANGED
@@ -6,9 +6,13 @@ require 'stringio'
|
|
6
6
|
module Protobuf
|
7
7
|
end
|
8
8
|
|
9
|
+
|
10
|
+
Protobuf::ClientType = ENV['PB_CLIENT_TYPE'] if ENV['PB_CLIENT_TYPE']
|
11
|
+
Protobuf::ServerType = ENV['PB_SERVER_TYPE'] if ENV['PB_SERVER_TYPE']
|
12
|
+
|
9
13
|
# When setting up a client
|
10
|
-
unless defined?(Protobuf::
|
11
|
-
Protobuf::
|
14
|
+
unless defined?(Protobuf::ClientType) && Protobuf::ClientType == "Socket"
|
15
|
+
Protobuf::ClientType = "EventMachine"
|
12
16
|
require 'eventmachine'
|
13
17
|
require 'protobuf/ext/eventmachine'
|
14
18
|
require 'protobuf/rpc/connectors/eventmachine'
|
@@ -3,8 +3,8 @@ module Protobuf
|
|
3
3
|
class Connector
|
4
4
|
|
5
5
|
def self.connector_for_client
|
6
|
-
if defined?(Protobuf::
|
7
|
-
case Protobuf::
|
6
|
+
if defined?(Protobuf::ClientType)
|
7
|
+
case Protobuf::ClientType
|
8
8
|
when "Socket" then
|
9
9
|
::Protobuf::Rpc::Connectors::Socket
|
10
10
|
else
|
data/lib/protobuf/version.rb
CHANGED
data/spec/benchmark/tasks.rb
CHANGED
@@ -55,7 +55,7 @@ namespace :benchmark do
|
|
55
55
|
EM.stop if EM.reactor_running?
|
56
56
|
|
57
57
|
StubServer.new(:server => Protobuf::Rpc::SocketServer, :port => 9399) do |server|
|
58
|
-
with_constants "Protobuf::
|
58
|
+
with_constants "Protobuf::ClientType" => "Socket" do
|
59
59
|
client = Spec::Proto::TestService.client(:async => false, :port => 9399)
|
60
60
|
|
61
61
|
benchmark_wrapper(global_bench) do |bench|
|
@@ -73,7 +73,7 @@ namespace :benchmark do
|
|
73
73
|
Thread.pass until EM.reactor_running?
|
74
74
|
|
75
75
|
StubServer.new(:port => 9399) do |server|
|
76
|
-
with_constants "Protobuf::
|
76
|
+
with_constants "Protobuf::ClientType" => "Socket" do
|
77
77
|
client = Spec::Proto::TestService.client(:async => false, :port => 9399)
|
78
78
|
|
79
79
|
benchmark_wrapper(global_bench) do |bench|
|
@@ -6,7 +6,7 @@ describe Protobuf::Rpc::Connector do
|
|
6
6
|
|
7
7
|
context 'when set to Socket connector' do
|
8
8
|
it 'returns a socket connector class reference' do
|
9
|
-
with_constants "Protobuf::
|
9
|
+
with_constants "Protobuf::ClientType" => "Socket" do
|
10
10
|
Protobuf::Rpc::Connector.connector_for_client.should eq(Protobuf::Rpc::Connectors::Socket)
|
11
11
|
end
|
12
12
|
end
|
@@ -14,7 +14,7 @@ describe Protobuf::Rpc::Connector do
|
|
14
14
|
|
15
15
|
context 'when set to non Socket Connector' do
|
16
16
|
it 'returns an eventmachine connector class reference' do
|
17
|
-
with_constants "Protobuf::
|
17
|
+
with_constants "Protobuf::ClientType" => "EventMachine" do
|
18
18
|
Protobuf::Rpc::Connector.connector_for_client.should eq Protobuf::Rpc::Connectors::EventMachine
|
19
19
|
end
|
20
20
|
end
|
@@ -35,7 +35,7 @@ describe Protobuf::Rpc::SocketServer do
|
|
35
35
|
|
36
36
|
context "Eventmachine client" do
|
37
37
|
it "calls the service in the client request" do
|
38
|
-
with_constants "Protobuf::
|
38
|
+
with_constants "Protobuf::ClientType" => "Evented" do
|
39
39
|
client = Spec::Proto::TestService.client(:async => false, :port => 9399, :host => "127.0.0.1")
|
40
40
|
|
41
41
|
client.find(:name => "Test Name", :active => true) do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-02-
|
13
|
+
date: 2012-02-07 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: eventmachine
|
17
|
-
requirement: &
|
17
|
+
requirement: &2165510400 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.12.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2165510400
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: eventually
|
28
|
-
requirement: &
|
28
|
+
requirement: &2165509320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 0.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2165509320
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: json_pure
|
39
|
-
requirement: &
|
39
|
+
requirement: &2165507640 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 1.6.4
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2165507640
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rake
|
50
|
-
requirement: &
|
50
|
+
requirement: &2165506400 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.8.7
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2165506400
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rspec
|
61
|
-
requirement: &
|
61
|
+
requirement: &2165505500 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 2.8.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2165505500
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: yard
|
72
|
-
requirement: &
|
72
|
+
requirement: &2165504360 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 0.7.4
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2165504360
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: redcarpet
|
83
|
-
requirement: &
|
83
|
+
requirement: &2165503160 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.17.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2165503160
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: simplecov
|
94
|
-
requirement: &
|
94
|
+
requirement: &2165501280 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
version: 0.5.4
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2165501280
|
103
103
|
description: ! 'Ruby implementation for Protocol Buffers. Works with other protobuf
|
104
104
|
rpc implementations (e.g. Java, Python, C++).
|
105
105
|
|