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
diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb
index 309dd33..92203ce 100644
--- a/src/ruby/bin/interop/interop_client.rb
+++ b/src/ruby/bin/interop/interop_client.rb
@@ -47,8 +47,6 @@
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 9e5c20d..35d69f6 100644
--- a/src/ruby/bin/interop/interop_server.rb
+++ b/src/ruby/bin/interop/interop_server.rb
@@ -46,8 +46,6 @@
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 947e86a..8a62764 100644
--- a/src/ruby/bin/math_client.rb
+++ b/src/ruby/bin/math_client.rb
@@ -40,8 +40,6 @@
$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 d21ae7e..ed39144 100644
--- a/src/ruby/bin/math_server.rb
+++ b/src/ruby/bin/math_server.rb
@@ -41,8 +41,6 @@
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 fbd10a0..29ed6d9 100644
--- a/src/ruby/bin/noproto_client.rb
+++ b/src/ruby/bin/noproto_client.rb
@@ -37,8 +37,6 @@
$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 c5b7c19..7b74fa1 100644
--- a/src/ruby/bin/noproto_server.rb
+++ b/src/ruby/bin/noproto_server.rb
@@ -37,8 +37,6 @@
$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 1012a83..c7eec33 100644
--- a/src/ruby/lib/grpc.rb
+++ b/src/ruby/lib/grpc.rb
@@ -34,6 +34,10 @@
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 95cc7fc..187c238 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 @@
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 91ceaa9..74cc9db 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 b0e7226..62628cb 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 b41543e..10767c4 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 @@
# 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 76e7838..7754b8d 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 05bb0af..6a4356f 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 @@
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 a8ee3c0..0bebe5d 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 c76f3b2..42da3f8 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 8a185df..83979ec 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 7c9b074..5997fdb 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'