From: Kevin Clark Date: Wed, 18 Jun 2008 00:55:29 +0000 (+0000) Subject: Add in hook to only provide the deprecated API when the client doesn't require 'thrif... X-Git-Tag: 0.2.0~641 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=0d1849d88206b5205a8862471032d39206062f23;p=common%2Fthrift.git Add in hook to only provide the deprecated API when the client doesn't require 'thrift' directly git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668908 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/lib/thrift.rb b/lib/rb/lib/thrift.rb index 210e60bd..9c9c4b26 100644 --- a/lib/rb/lib/thrift.rb +++ b/lib/rb/lib/thrift.rb @@ -10,32 +10,18 @@ $:.unshift File.dirname(__FILE__) -require 'thrift/exceptions' -TException = Thrift::Exception -TApplicationException = Thrift::ApplicationException +module Thrift + # prevent the deprecation layer from being loaded if you require 'thrift' + DEPRECATION = false unless const_defined? :DEPRECATION +end +require 'thrift/deprecation' +require 'thrift/exceptions' require 'thrift/types' -TType = Thrift::Types -TMessageType = Thrift::MessageTypes - require 'thrift/processor' -TProcessor = Thrift::Processor - require 'thrift/client' -ThriftClient = Thrift::Client - require 'thrift/struct' -ThriftStruct = Thrift::Struct - require 'thrift/protocol/tprotocol' -TProtocol = Thrift::Protocol -TProtocolException = Thrift::ProtocolException - require 'thrift/transport/tsocket' require 'thrift/transport/ttransport' - require 'thrift/server/tserver' - - - - diff --git a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb index 3a3fcacd..a0618b60 100644 --- a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb +++ b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb @@ -183,7 +183,9 @@ module Thrift end end -TBinaryProtocol = Thrift::BinaryProtocol +if Thrift::DEPRECATION + TBinaryProtocol = Thrift::BinaryProtocol +end class TBinaryProtocolFactory < TProtocolFactory def getProtocol(trans)