Return-Path: Delivered-To: apmail-incubator-thrift-commits-archive@minotaur.apache.org Received: (qmail 43690 invoked from network); 7 Apr 2009 19:09:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Apr 2009 19:09:50 -0000 Received: (qmail 83275 invoked by uid 500); 7 Apr 2009 19:09:50 -0000 Delivered-To: apmail-incubator-thrift-commits-archive@incubator.apache.org Received: (qmail 83244 invoked by uid 500); 7 Apr 2009 19:09:50 -0000 Mailing-List: contact thrift-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: thrift-dev@incubator.apache.org Delivered-To: mailing list thrift-commits@incubator.apache.org Received: (qmail 83235 invoked by uid 99); 7 Apr 2009 19:09:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 19:09:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 19:09:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AA03B23889C4; Tue, 7 Apr 2009 19:09:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r762907 - in /incubator/thrift/trunk: compiler/cpp/src/generate/ lib/rb/spec/ Date: Tue, 07 Apr 2009 19:09:29 -0000 To: thrift-commits@incubator.apache.org From: kclark@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090407190929.AA03B23889C4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kclark Date: Tue Apr 7 19:09:28 2009 New Revision: 762907 URL: http://svn.apache.org/viewvc?rev=762907&view=rev Log: Thrift-421. rb: Underscore output file names and require file statments Breaks compatiblity Author: Michael Stockton Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_generator.h incubator/thrift/trunk/compiler/cpp/src/generate/t_rb_generator.cc incubator/thrift/trunk/lib/rb/spec/binary_protocol_accelerated_spec.rb incubator/thrift/trunk/lib/rb/spec/nonblocking_server_spec.rb incubator/thrift/trunk/lib/rb/spec/serializer_spec.rb incubator/thrift/trunk/lib/rb/spec/struct_spec.rb incubator/thrift/trunk/lib/rb/spec/types_spec.rb Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_generator.h URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_generator.h?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/compiler/cpp/src/generate/t_generator.h (original) +++ incubator/thrift/trunk/compiler/cpp/src/generate/t_generator.h Tue Apr 7 19:09:28 2009 @@ -178,6 +178,16 @@ } return in; } + std::string underscore(std::string in) { + in[0] = tolower(in[0]); + for (size_t i = 1; i < in.size(); ++i) { + if (isupper(in[i])) { + in[i] = tolower(in[i]); + in.insert(i, "_"); + } + } + return in; + } /** * Get the true type behind a series of typedefs. Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_rb_generator.cc URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_rb_generator.cc?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/compiler/cpp/src/generate/t_rb_generator.cc (original) +++ incubator/thrift/trunk/compiler/cpp/src/generate/t_rb_generator.cc Tue Apr 7 19:09:28 2009 @@ -204,10 +204,10 @@ MKDIR(get_out_dir().c_str()); // Make output file - string f_types_name = get_out_dir()+program_name_+"_types.rb"; + string f_types_name = get_out_dir()+underscore(program_name_)+"_types.rb"; f_types_.open(f_types_name.c_str()); - string f_consts_name = get_out_dir()+program_name_+"_constants.rb"; + string f_consts_name = get_out_dir()+underscore(program_name_)+"_constants.rb"; f_consts_.open(f_consts_name.c_str()); // Print header @@ -218,7 +218,7 @@ f_consts_ << rb_autogen_comment() << endl << - "require File.dirname(__FILE__) + '/" << program_name_ << "_types'" << endl << + "require File.dirname(__FILE__) + '/" << underscore(program_name_) << "_types'" << endl << endl; begin_namespace(f_consts_, ruby_modules(program_)); @@ -231,7 +231,7 @@ const vector& includes = program_->get_includes(); string result = ""; for (size_t i = 0; i < includes.size(); ++i) { - result += "require '" + includes[i]->get_name() + "_types'\n"; + result += "require '" + underscore(includes[i]->get_name()) + "_types'\n"; } if (includes.size() > 0) { result += "\n"; @@ -622,7 +622,7 @@ * @param tservice The service definition */ void t_rb_generator::generate_service(t_service* tservice) { - string f_service_name = get_out_dir()+service_name_+".rb"; + string f_service_name = get_out_dir()+underscore(service_name_)+".rb"; f_service_.open(f_service_name.c_str()); f_service_ << @@ -631,11 +631,11 @@ if (tservice->get_extends() != NULL) { f_service_ << - "require '" << tservice->get_extends()->get_name() << "'" << endl; + "require '" << underscore(tservice->get_extends()->get_name()) << "'" << endl; } f_service_ << - "require File.dirname(__FILE__) + '/" << program_name_ << "_types'" << endl << + "require File.dirname(__FILE__) + '/" << underscore(program_name_) << "_types'" << endl << endl; begin_namespace(f_service_, ruby_modules(tservice->get_program())); Modified: incubator/thrift/trunk/lib/rb/spec/binary_protocol_accelerated_spec.rb URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/binary_protocol_accelerated_spec.rb?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/lib/rb/spec/binary_protocol_accelerated_spec.rb (original) +++ incubator/thrift/trunk/lib/rb/spec/binary_protocol_accelerated_spec.rb Tue Apr 7 19:09:28 2009 @@ -19,7 +19,7 @@ require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/binary_protocol_spec_shared' -require File.dirname(__FILE__) + '/gen-rb/ThriftSpec_types' +require File.dirname(__FILE__) + '/gen-rb/thrift_spec_types' class ThriftBinaryProtocolAcceleratedSpec < Spec::ExampleGroup include Thrift Modified: incubator/thrift/trunk/lib/rb/spec/nonblocking_server_spec.rb URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/nonblocking_server_spec.rb?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/lib/rb/spec/nonblocking_server_spec.rb (original) +++ incubator/thrift/trunk/lib/rb/spec/nonblocking_server_spec.rb Tue Apr 7 19:09:28 2009 @@ -18,7 +18,7 @@ # require File.dirname(__FILE__) + '/spec_helper' -require File.dirname(__FILE__) + '/gen-rb/NonblockingService' +require File.dirname(__FILE__) + '/gen-rb/nonblocking_service' class ThriftNonblockingServerSpec < Spec::ExampleGroup include Thrift Modified: incubator/thrift/trunk/lib/rb/spec/serializer_spec.rb URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/serializer_spec.rb?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/lib/rb/spec/serializer_spec.rb (original) +++ incubator/thrift/trunk/lib/rb/spec/serializer_spec.rb Tue Apr 7 19:09:28 2009 @@ -18,7 +18,7 @@ # require File.dirname(__FILE__) + '/spec_helper' -require File.dirname(__FILE__) + '/gen-rb/ThriftSpec_types' +require File.dirname(__FILE__) + '/gen-rb/thrift_spec_types' class ThriftSerializerSpec < Spec::ExampleGroup include Thrift Modified: incubator/thrift/trunk/lib/rb/spec/struct_spec.rb URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/struct_spec.rb?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/lib/rb/spec/struct_spec.rb (original) +++ incubator/thrift/trunk/lib/rb/spec/struct_spec.rb Tue Apr 7 19:09:28 2009 @@ -18,7 +18,7 @@ # require File.dirname(__FILE__) + '/spec_helper' -require File.dirname(__FILE__) + '/gen-rb/ThriftSpec_types' +require File.dirname(__FILE__) + '/gen-rb/thrift_spec_types' class ThriftStructSpec < Spec::ExampleGroup include Thrift Modified: incubator/thrift/trunk/lib/rb/spec/types_spec.rb URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/types_spec.rb?rev=762907&r1=762906&r2=762907&view=diff ============================================================================== --- incubator/thrift/trunk/lib/rb/spec/types_spec.rb (original) +++ incubator/thrift/trunk/lib/rb/spec/types_spec.rb Tue Apr 7 19:09:28 2009 @@ -18,7 +18,7 @@ # require File.dirname(__FILE__) + '/spec_helper' -require File.dirname(__FILE__) + '/gen-rb/ThriftSpec_types' +require File.dirname(__FILE__) + '/gen-rb/thrift_spec_types' class ThriftTypesSpec < Spec::ExampleGroup include Thrift