aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby
diff options
context:
space:
mode:
authorGravatar temiola <temiola@google.com>2014-12-11 11:23:37 -0800
committerGravatar Jan Tattermusch <jtattermusch@google.com>2014-12-11 15:11:44 -0800
commit4a3be1c996e3a0a79cebb0bb33196b7c6860a334 (patch)
tree300c64fc01484957c8a6911083c36837443a7253 /src/ruby
parent4eec017e8e3ba501d1b90f2131a1ff4f3df77de0 (diff)
Update modules and packages to allow for a single grpc import
- ensured tests only need to do 'require grpc' - ensured that the example math_server and math_client only need to do 'require grpc' - ensured that the other other client and servers only need to do one thing Change on 2014/12/11 by temiola <temiola@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=81894613
Diffstat (limited to 'src/ruby')
-rw-r--r--src/ruby/bin/interop/interop_client.rb2
-rw-r--r--src/ruby/bin/interop/interop_server.rb2
-rw-r--r--src/ruby/bin/math_client.rb2
-rw-r--r--src/ruby/bin/math_server.rb2
-rw-r--r--src/ruby/bin/noproto_client.rb2
-rw-r--r--src/ruby/bin/noproto_server.rb2
-rw-r--r--src/ruby/lib/grpc.rb4
-rw-r--r--src/ruby/lib/grpc/generic/active_call.rb3
-rw-r--r--src/ruby/lib/grpc/generic/bidi_call.rb4
-rw-r--r--src/ruby/lib/grpc/generic/client_stub.rb3
-rw-r--r--src/ruby/lib/grpc/generic/rpc_desc.rb6
-rw-r--r--src/ruby/lib/grpc/generic/rpc_server.rb4
-rw-r--r--src/ruby/lib/grpc/generic/service.rb3
-rw-r--r--src/ruby/spec/generic/active_call_spec.rb1
-rw-r--r--src/ruby/spec/generic/client_stub_spec.rb2
-rw-r--r--src/ruby/spec/generic/rpc_server_pool_spec.rb1
-rw-r--r--src/ruby/spec/generic/rpc_server_spec.rb4
17 files changed, 14 insertions, 33 deletions
diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb
index 309dd337ec..92203ce252 100644
--- a/src/ruby/bin/interop/interop_client.rb
+++ b/src/ruby/bin/interop/interop_client.rb
@@ -47,8 +47,6 @@ require 'minitest'
require 'minitest/assertions'
require 'grpc'
-require 'grpc/generic/client_stub'
-require 'grpc/generic/service'
require 'third_party/stubby/testing/proto/test.pb'
require 'third_party/stubby/testing/proto/messages.pb'
diff --git a/src/ruby/bin/interop/interop_server.rb b/src/ruby/bin/interop/interop_server.rb
index 9e5c20d443..35d69f6fd3 100644
--- a/src/ruby/bin/interop/interop_server.rb
+++ b/src/ruby/bin/interop/interop_server.rb
@@ -46,8 +46,6 @@ require 'forwardable'
require 'optparse'
require 'grpc'
-require 'grpc/generic/service'
-require 'grpc/generic/rpc_server'
require 'third_party/stubby/testing/proto/test.pb'
require 'third_party/stubby/testing/proto/messages.pb'
diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb
index 947e86adf9..8a62764c08 100644
--- a/src/ruby/bin/math_client.rb
+++ b/src/ruby/bin/math_client.rb
@@ -40,8 +40,6 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'grpc'
-require 'grpc/generic/client_stub'
-require 'grpc/generic/service'
require 'math.pb'
require 'optparse'
diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb
index d21ae7ee27..ed39144d7a 100644
--- a/src/ruby/bin/math_server.rb
+++ b/src/ruby/bin/math_server.rb
@@ -41,8 +41,6 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'forwardable'
require 'grpc'
-require 'grpc/generic/service'
-require 'grpc/generic/rpc_server'
require 'math.pb'
require 'optparse'
diff --git a/src/ruby/bin/noproto_client.rb b/src/ruby/bin/noproto_client.rb
index fbd10a06b5..29ed6d9f7c 100644
--- a/src/ruby/bin/noproto_client.rb
+++ b/src/ruby/bin/noproto_client.rb
@@ -37,8 +37,6 @@ lib_dir = File.join(File.dirname(this_dir), 'lib')
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
require 'grpc'
-require 'grpc/generic/client_stub'
-require 'grpc/generic/service'
class EchoMsg
def marshal
diff --git a/src/ruby/bin/noproto_server.rb b/src/ruby/bin/noproto_server.rb
index c5b7c192eb..7b74fa13ec 100644
--- a/src/ruby/bin/noproto_server.rb
+++ b/src/ruby/bin/noproto_server.rb
@@ -37,8 +37,6 @@ lib_dir = File.join(File.dirname(this_dir), 'lib')
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
require 'grpc'
-require 'grpc/generic/rpc_server'
-require 'grpc/generic/service'
class EchoMsg
def marshal
diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb
index 1012a836b7..c7eec3388c 100644
--- a/src/ruby/lib/grpc.rb
+++ b/src/ruby/lib/grpc.rb
@@ -34,6 +34,10 @@ require 'grpc/logconfig'
require 'grpc/version'
require 'grpc/core/event'
require 'grpc/core/time_consts'
+require 'grpc/generic/active_call'
+require 'grpc/generic/client_stub'
+require 'grpc/generic/service'
+require 'grpc/generic/rpc_server'
# alias GRPC
GRPC = Google::RPC
diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb
index 95cc7fc708..187c23843b 100644
--- a/src/ruby/lib/grpc/generic/active_call.rb
+++ b/src/ruby/lib/grpc/generic/active_call.rb
@@ -28,7 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'forwardable'
-require 'grpc'
require 'grpc/generic/bidi_call'
def assert_event_type(ev, want)
@@ -37,7 +36,7 @@ def assert_event_type(ev, want)
raise 'Unexpected rpc event: got %s, want %s' % [got, want] unless got == want
end
-module GRPC
+module Google::RPC
# The ActiveCall class provides simple methods for sending marshallable
# data to a call
diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb
index 91ceaa90e5..74cc9db57e 100644
--- a/src/ruby/lib/grpc/generic/bidi_call.rb
+++ b/src/ruby/lib/grpc/generic/bidi_call.rb
@@ -28,9 +28,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'forwardable'
-require 'grpc'
+require 'grpc/grpc'
-module GRPC
+module Google::RPC
# The BiDiCall class orchestrates exection of a BiDi stream on a client or
# server.
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb
index b0e72262ff..62628cb1f0 100644
--- a/src/ruby/lib/grpc/generic/client_stub.rb
+++ b/src/ruby/lib/grpc/generic/client_stub.rb
@@ -27,11 +27,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-require 'grpc'
require 'grpc/generic/active_call'
require 'xray/thread_dump_signal_handler'
-module GRPC
+module Google::RPC
# ClientStub represents an endpoint used to send requests to GRPC servers.
class ClientStub
diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb
index b41543e084..10767c47de 100644
--- a/src/ruby/lib/grpc/generic/rpc_desc.rb
+++ b/src/ruby/lib/grpc/generic/rpc_desc.rb
@@ -27,9 +27,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-require 'grpc'
+require 'grpc/grpc'
-module GRPC
+module Google::RPC
# RpcDesc is a Descriptor of an RPC method.
class RpcDesc < Struct.new(:name, :input, :output, :marshal_method,
@@ -99,7 +99,7 @@ module GRPC
# event. Send a status of deadline exceeded
logger.warn("late call: #{active_call}")
send_status(active_call, DEADLINE_EXCEEDED, 'late')
- rescue Core::EventError => e
+ rescue EventError => e
# This is raised by GRPC internals but should rarely, if ever happen.
# Log it, but don't notify the other endpoint..
logger.warn("failed call: #{active_call}\n#{e}")
diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb
index 76e7838d0f..7754b8d7df 100644
--- a/src/ruby/lib/grpc/generic/rpc_server.rb
+++ b/src/ruby/lib/grpc/generic/rpc_server.rb
@@ -27,13 +27,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-require 'grpc'
+require 'grpc/grpc'
require 'grpc/generic/active_call'
require 'grpc/generic/service'
require 'thread'
require 'xray/thread_dump_signal_handler'
-module GRPC
+module Google::RPC
# RpcServer hosts a number of services and makes them available on the
# network.
diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb
index 05bb0af809..6a4356fab9 100644
--- a/src/ruby/lib/grpc/generic/service.rb
+++ b/src/ruby/lib/grpc/generic/service.rb
@@ -27,7 +27,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-require 'grpc'
require 'grpc/generic/client_stub'
require 'grpc/generic/rpc_desc'
@@ -51,7 +50,7 @@ class String
end
-module GRPC
+module Google::RPC
# Provides behaviour used to implement schema-derived service classes.
#
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb
index a8ee3c0da8..0bebe5dc37 100644
--- a/src/ruby/spec/generic/active_call_spec.rb
+++ b/src/ruby/spec/generic/active_call_spec.rb
@@ -28,7 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc'
-require 'grpc/generic/active_call'
require_relative '../port_picker'
include GRPC::Core::StatusCodes
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index c76f3b291e..42da3f82ec 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -28,8 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc'
-require 'grpc/generic/active_call'
-require 'grpc/generic/client_stub'
require 'xray/thread_dump_signal_handler'
require_relative '../port_picker'
diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb
index 8a185df9c7..83979ec164 100644
--- a/src/ruby/spec/generic/rpc_server_pool_spec.rb
+++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb
@@ -28,7 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc'
-require 'grpc/generic/rpc_server'
require 'xray/thread_dump_signal_handler'
Pool = GRPC::RpcServer::Pool
diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb
index 7c9b074abf..5997fdb363 100644
--- a/src/ruby/spec/generic/rpc_server_spec.rb
+++ b/src/ruby/spec/generic/rpc_server_spec.rb
@@ -28,10 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc'
-require 'grpc/generic/active_call'
-require 'grpc/generic/client_stub'
-require 'grpc/generic/rpc_server'
-require 'grpc/generic/service'
require 'xray/thread_dump_signal_handler'
require_relative '../port_picker'