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 210e60b..9c9c4b2 100644
--- a/lib/rb/lib/thrift.rb
+++ b/lib/rb/lib/thrift.rb
@@ -10,32 +10,18 @@
 
 $:.unshift File.dirname(__FILE__)
 
+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'
-TException = Thrift::Exception
-TApplicationException = Thrift::ApplicationException
-
 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 3a3fcac..a0618b6 100644
--- a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb
+++ b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb
@@ -183,7 +183,9 @@
   end
 end
 
-TBinaryProtocol = Thrift::BinaryProtocol
+if Thrift::DEPRECATION
+  TBinaryProtocol = Thrift::BinaryProtocol
+end
 
 class TBinaryProtocolFactory < TProtocolFactory
   def getProtocol(trans)