From: Bryan Duxbury Date: Mon, 30 Mar 2009 17:14:06 +0000 (+0000) Subject: THRIFT-410. rb: Ruby lib should have no checked in generated code X-Git-Tag: 0.2.0~202 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=f0377e2ffeb9b260a809f5d2c8ffef73b77755ec;p=common%2Fthrift.git THRIFT-410. rb: Ruby lib should have no checked in generated code This patch deletes the existing checked in ruby code, adds all the generated ruby code directories to svn:ignore, and updates the Rakefile so that "rake spec" generates the ruby code automatically. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760050 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/Rakefile b/lib/rb/Rakefile index 96d14482..a9d1710c 100644 --- a/lib/rb/Rakefile +++ b/lib/rb/Rakefile @@ -4,9 +4,11 @@ require 'spec/rake/spectask' THRIFT = '../../compiler/cpp/thrift' -task :default => [:'gen-rb', :spec, :test] +task :default => [:spec] -Spec::Rake::SpecTask.new do |t| +task :spec => [:'gen-rb', :realspec] + +Spec::Rake::SpecTask.new(:realspec) do |t| t.spec_files = FileList['spec/**/*_spec.rb'] t.spec_opts = ['--color'] end diff --git a/lib/rb/spec/gen-rb/NonblockingService.rb b/lib/rb/spec/gen-rb/NonblockingService.rb deleted file mode 100644 index c588604d..00000000 --- a/lib/rb/spec/gen-rb/NonblockingService.rb +++ /dev/null @@ -1,268 +0,0 @@ -# -# Autogenerated by Thrift -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'thrift' -require 'thrift/protocol' -require File.dirname(__FILE__) + '/ThriftSpec_types' - - module SpecNamespace - module NonblockingService - class Client - include ::Thrift::Client - - def greeting(english) - send_greeting(english) - return recv_greeting() - end - - def send_greeting(english) - send_message('greeting', Greeting_args, :english => english) - end - - def recv_greeting() - result = receive_message(Greeting_result) - return result.success unless result.success.nil? - raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result') - end - - def block() - send_block() - return recv_block() - end - - def send_block() - send_message('block', Block_args) - end - - def recv_block() - result = receive_message(Block_result) - return result.success unless result.success.nil? - raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result') - end - - def unblock(n) - send_unblock(n) - end - - def send_unblock(n) - send_message('unblock', Unblock_args, :n => n) - end - def shutdown() - send_shutdown() - end - - def send_shutdown() - send_message('shutdown', Shutdown_args) - end - def sleep(seconds) - send_sleep(seconds) - recv_sleep() - end - - def send_sleep(seconds) - send_message('sleep', Sleep_args, :seconds => seconds) - end - - def recv_sleep() - result = receive_message(Sleep_result) - return - end - - end - - class Processor - include ::Thrift::Processor - - def process_greeting(seqid, iprot, oprot) - args = read_args(iprot, Greeting_args) - result = Greeting_result.new() - result.success = @handler.greeting(args.english) - write_result(result, oprot, 'greeting', seqid) - end - - def process_block(seqid, iprot, oprot) - args = read_args(iprot, Block_args) - result = Block_result.new() - result.success = @handler.block() - write_result(result, oprot, 'block', seqid) - end - - def process_unblock(seqid, iprot, oprot) - args = read_args(iprot, Unblock_args) - @handler.unblock(args.n) - return - end - - def process_shutdown(seqid, iprot, oprot) - args = read_args(iprot, Shutdown_args) - @handler.shutdown() - return - end - - def process_sleep(seqid, iprot, oprot) - args = read_args(iprot, Sleep_args) - result = Sleep_result.new() - @handler.sleep(args.seconds) - write_result(result, oprot, 'sleep', seqid) - end - - end - - # HELPER FUNCTIONS AND STRUCTURES - - class Greeting_args - include ::Thrift::Struct - ENGLISH = 1 - - Thrift::Struct.field_accessor self, :english - FIELDS = { - ENGLISH => {:type => Thrift::Types::BOOL, :name => 'english'} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Greeting_result - include ::Thrift::Struct - SUCCESS = 0 - - Thrift::Struct.field_accessor self, :success - FIELDS = { - SUCCESS => {:type => Thrift::Types::STRUCT, :name => 'success', :class => SpecNamespace::Hello} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Block_args - include ::Thrift::Struct - - FIELDS = { - - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Block_result - include ::Thrift::Struct - SUCCESS = 0 - - Thrift::Struct.field_accessor self, :success - FIELDS = { - SUCCESS => {:type => Thrift::Types::BOOL, :name => 'success'} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Unblock_args - include ::Thrift::Struct - N = 1 - - Thrift::Struct.field_accessor self, :n - FIELDS = { - N => {:type => Thrift::Types::I32, :name => 'n'} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Unblock_result - include ::Thrift::Struct - - FIELDS = { - - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Shutdown_args - include ::Thrift::Struct - - FIELDS = { - - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Shutdown_result - include ::Thrift::Struct - - FIELDS = { - - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Sleep_args - include ::Thrift::Struct - SECONDS = 1 - - Thrift::Struct.field_accessor self, :seconds - FIELDS = { - SECONDS => {:type => Thrift::Types::DOUBLE, :name => 'seconds'} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Sleep_result - include ::Thrift::Struct - - FIELDS = { - - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - end - - end diff --git a/lib/rb/spec/gen-rb/ThriftSpec_constants.rb b/lib/rb/spec/gen-rb/ThriftSpec_constants.rb deleted file mode 100644 index 973501cb..00000000 --- a/lib/rb/spec/gen-rb/ThriftSpec_constants.rb +++ /dev/null @@ -1,11 +0,0 @@ -# -# Autogenerated by Thrift -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'thrift/protocol' -require File.dirname(__FILE__) + '/ThriftSpec_types' - - module SpecNamespace -end diff --git a/lib/rb/spec/gen-rb/ThriftSpec_types.rb b/lib/rb/spec/gen-rb/ThriftSpec_types.rb deleted file mode 100644 index f9d75266..00000000 --- a/lib/rb/spec/gen-rb/ThriftSpec_types.rb +++ /dev/null @@ -1,134 +0,0 @@ -# -# Autogenerated by Thrift -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# - -require 'thrift/protocol' - -module SpecNamespace - class Hello - include ::Thrift::Struct - GREETING = 1 - - Thrift::Struct.field_accessor self, :greeting - FIELDS = { - GREETING => {:type => Thrift::Types::STRING, :name => 'greeting', :default => %q"hello world"} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Foo - include ::Thrift::Struct - SIMPLE = 1 - WORDS = 2 - HELLO = 3 - INTS = 4 - COMPLEX = 5 - SHORTS = 6 - OPT_STRING = 7 - - Thrift::Struct.field_accessor self, :simple, :words, :hello, :ints, :complex, :shorts, :opt_string - FIELDS = { - SIMPLE => {:type => Thrift::Types::I32, :name => 'simple', :default => 53}, - WORDS => {:type => Thrift::Types::STRING, :name => 'words', :default => %q"words"}, - HELLO => {:type => Thrift::Types::STRUCT, :name => 'hello', :default => Hello.new({ - %q"greeting" => %q"hello, world!", - }), :class => SpecNamespace::Hello}, - INTS => {:type => Thrift::Types::LIST, :name => 'ints', :default => [ - 1, - 2, - 2, - 3, - ], :element => {:type => Thrift::Types::I32}}, - COMPLEX => {:type => Thrift::Types::MAP, :name => 'complex', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::DOUBLE}}}, - SHORTS => {:type => Thrift::Types::SET, :name => 'shorts', :default => Set.new([ 5, - 17, - 239, - ]), :element => {:type => Thrift::Types::I16}}, - OPT_STRING => {:type => Thrift::Types::STRING, :name => 'opt_string', :optional => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class BoolStruct - include ::Thrift::Struct - YESNO = 1 - - Thrift::Struct.field_accessor self, :yesno - FIELDS = { - YESNO => {:type => Thrift::Types::BOOL, :name => 'yesno', :default => true} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class SimpleList - include ::Thrift::Struct - BOOLS = 1 - BYTES = 2 - I16S = 3 - I32S = 4 - I64S = 5 - DOUBLES = 6 - STRINGS = 7 - MAPS = 8 - LISTS = 9 - SETS = 10 - HELLOS = 11 - - Thrift::Struct.field_accessor self, :bools, :bytes, :i16s, :i32s, :i64s, :doubles, :strings, :maps, :lists, :sets, :hellos - FIELDS = { - BOOLS => {:type => Thrift::Types::LIST, :name => 'bools', :element => {:type => Thrift::Types::BOOL}}, - BYTES => {:type => Thrift::Types::LIST, :name => 'bytes', :element => {:type => Thrift::Types::BYTE}}, - I16S => {:type => Thrift::Types::LIST, :name => 'i16s', :element => {:type => Thrift::Types::I16}}, - I32S => {:type => Thrift::Types::LIST, :name => 'i32s', :element => {:type => Thrift::Types::I32}}, - I64S => {:type => Thrift::Types::LIST, :name => 'i64s', :element => {:type => Thrift::Types::I64}}, - DOUBLES => {:type => Thrift::Types::LIST, :name => 'doubles', :element => {:type => Thrift::Types::DOUBLE}}, - STRINGS => {:type => Thrift::Types::LIST, :name => 'strings', :element => {:type => Thrift::Types::STRING}}, - MAPS => {:type => Thrift::Types::LIST, :name => 'maps', :element => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I16}, :value => {:type => Thrift::Types::I16}}}, - LISTS => {:type => Thrift::Types::LIST, :name => 'lists', :element => {:type => Thrift::Types::LIST, :element => {:type => Thrift::Types::I16}}}, - SETS => {:type => Thrift::Types::LIST, :name => 'sets', :element => {:type => Thrift::Types::SET, :element => {:type => Thrift::Types::I16}}}, - HELLOS => {:type => Thrift::Types::LIST, :name => 'hellos', :element => {:type => Thrift::Types::STRUCT, :class => SpecNamespace::Hello}} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - class Xception < Thrift::Exception - include ::Thrift::Struct - MESSAGE = 1 - CODE = 2 - - Thrift::Struct.field_accessor self, :message, :code - FIELDS = { - MESSAGE => {:type => Thrift::Types::STRING, :name => 'message'}, - CODE => {:type => Thrift::Types::I32, :name => 'code', :default => 1} - } - - def struct_fields; FIELDS; end - - def validate - end - - end - - end