ruby_protobuf 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. data/History.txt +10 -2
  2. data/Manifest.txt +26 -12
  3. data/README.txt +6 -1
  4. data/Rakefile +51 -14
  5. data/TODO +15 -0
  6. data/VERSION +1 -0
  7. data/bin/rprotoc +11 -6
  8. data/lib/protobuf/common/exceptions.rb +11 -0
  9. data/lib/protobuf/common/util.rb +9 -0
  10. data/lib/protobuf/common/wire_type.rb +6 -6
  11. data/lib/protobuf/compiler/compiler.rb +16 -16
  12. data/lib/protobuf/compiler/nodes.rb +67 -65
  13. data/lib/protobuf/compiler/proto.y +31 -38
  14. data/lib/protobuf/compiler/proto_parser.rb +315 -294
  15. data/lib/protobuf/compiler/template/rpc_bin.erb +1 -1
  16. data/lib/protobuf/compiler/template/rpc_client.erb +1 -1
  17. data/lib/protobuf/compiler/template/rpc_service.erb +2 -2
  18. data/lib/protobuf/compiler/visitors.rb +45 -39
  19. data/lib/protobuf/descriptor/descriptor.proto +0 -0
  20. data/lib/protobuf/descriptor/descriptor.rb +11 -10
  21. data/lib/protobuf/descriptor/descriptor_builder.rb +6 -7
  22. data/lib/protobuf/descriptor/descriptor_proto.rb +51 -31
  23. data/lib/protobuf/descriptor/enum_descriptor.rb +5 -5
  24. data/lib/protobuf/descriptor/field_descriptor.rb +8 -9
  25. data/lib/protobuf/descriptor/file_descriptor.rb +0 -1
  26. data/lib/protobuf/message/decoder.rb +33 -35
  27. data/lib/protobuf/message/encoder.rb +23 -19
  28. data/lib/protobuf/message/enum.rb +43 -9
  29. data/lib/protobuf/message/field.rb +281 -193
  30. data/lib/protobuf/message/message.rb +166 -110
  31. data/lib/protobuf/message/protoable.rb +4 -3
  32. data/lib/protobuf/message/service.rb +1 -1
  33. data/lib/protobuf/rpc/client.rb +3 -3
  34. data/lib/protobuf/rpc/handler.rb +1 -1
  35. data/lib/protobuf/rpc/server.rb +8 -8
  36. data/lib/ruby_protobuf.rb +1 -1
  37. data/test/check_unbuild.rb +7 -7
  38. data/test/proto/addressbook.pb.rb +67 -0
  39. data/test/proto/addressbook.proto +2 -0
  40. data/test/proto/addressbook_base.pb.rb +59 -0
  41. data/test/proto/addressbook_base.proto +1 -1
  42. data/test/proto/addressbook_ext.pb.rb +21 -0
  43. data/test/proto/addressbook_ext.proto +2 -2
  44. data/test/{collision.rb → proto/collision.pb.rb} +0 -0
  45. data/test/{ext_collision.rb → proto/ext_collision.pb.rb} +1 -1
  46. data/test/{ext_range.rb → proto/ext_range.pb.rb} +4 -4
  47. data/test/proto/ext_range.proto +2 -2
  48. data/test/proto/float_default.proto +10 -0
  49. data/test/proto/lowercase.pb.rb +31 -0
  50. data/test/proto/lowercase.proto +9 -0
  51. data/test/{merge.rb → proto/merge.pb.rb} +2 -2
  52. data/test/proto/nested.pb.rb +31 -0
  53. data/test/proto/nested.proto +2 -0
  54. data/test/proto/optional_field.pb.rb +36 -0
  55. data/test/proto/optional_field.proto +12 -0
  56. data/test/proto/packed.pb.rb +23 -0
  57. data/test/proto/packed.proto +6 -0
  58. data/test/{types.rb → proto/types.pb.rb} +43 -1
  59. data/test/test_addressbook.rb +30 -17
  60. data/test/test_compiler.rb +79 -78
  61. data/test/test_descriptor.rb +12 -12
  62. data/test/test_enum_value.rb +41 -0
  63. data/test/test_extension.rb +10 -14
  64. data/test/test_lowercase.rb +11 -0
  65. data/test/test_message.rb +44 -41
  66. data/test/test_optional_field.rb +61 -38
  67. data/test/test_packed_field.rb +40 -0
  68. data/test/test_parse.rb +8 -8
  69. data/test/test_repeated_types.rb +29 -3
  70. data/test/test_serialize.rb +12 -12
  71. data/test/test_standard_message.rb +30 -30
  72. data/test/test_types.rb +95 -95
  73. metadata +69 -39
  74. data/test/addressbook.rb +0 -98
  75. data/test/addressbook_base.rb +0 -62
  76. data/test/addressbook_ext.rb +0 -12
  77. data/test/nested.rb +0 -25
  78. data/test/test_ruby_protobuf.rb +0 -1
data/test/test_types.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  require 'test/unit'
2
- require 'test/types'
2
+ require 'test/proto/types.pb'
3
3
 
4
4
  class TypesTest < Test::Unit::TestCase
5
5
  def test_serialize
6
6
  types = Test::Types::TestTypes.new
7
7
  types.type1 = 0.01
8
- types.type2 = 0.1
8
+ types.type2 = 0.1
9
9
  types.type3 = 1
10
- types.type4 = 10
10
+ types.type4 = 10
11
11
  types.type5 = 100
12
12
  types.type6 = 1000
13
13
  types.type7 = -1
@@ -24,21 +24,21 @@ class TypesTest < Test::Unit::TestCase
24
24
  serialized_string = types.serialize_to_string
25
25
 
26
26
  types2 = Test::Types::TestTypes.new
27
- types2.parse_from_string serialized_string
28
- assert_in_delta 0.01, types2.type1, 0.00001
29
- assert_in_delta 0.1, types2.type2, 0.00001
30
- assert_equal 1, types2.type3
31
- assert_equal 10, types2.type4
32
- assert_equal 100, types2.type5
33
- assert_equal 1000, types2.type6
27
+ types2.parse_from_string(serialized_string)
28
+ assert_in_delta(0.01, types2.type1, 0.00001)
29
+ assert_in_delta(0.1, types2.type2, 0.00001)
30
+ assert_equal(1, types2.type3)
31
+ assert_equal(10, types2.type4)
32
+ assert_equal(100, types2.type5)
33
+ assert_equal(1000, types2.type6)
34
34
  assert_equal(-1, types2.type7)
35
35
  assert_equal(-10, types2.type8)
36
- assert_equal 10000, types2.type9
37
- assert_equal 100000, types2.type10
38
- assert !types2.type11
39
- assert_equal 'hello all types', types2.type12
40
- assert_equal 10938, types2.type13.size
41
- assert_equal image_bin, types2.type13
36
+ assert_equal(10000, types2.type9)
37
+ assert_equal(100000, types2.type10)
38
+ assert(!types2.type11)
39
+ assert_equal('hello all types', types2.type12)
40
+ assert_equal(10938, types2.type13.size)
41
+ assert_equal(image_bin, types2.type13)
42
42
  assert_equal(-100, types2.type14)
43
43
  assert_equal(-1000, types2.type15)
44
44
  end
@@ -65,7 +65,7 @@ class TypesTest < Test::Unit::TestCase
65
65
  serialized_string = types.serialize_to_string
66
66
 
67
67
  types2 = Test::Types::TestTypes.new
68
- types2.parse_from_string serialized_string
68
+ types2.parse_from_string(serialized_string)
69
69
  assert_equal(1.0/0.0, types2.type1)
70
70
  assert_equal(-1.0/0.0, types2.type2)
71
71
  assert_equal(-1, types2.type3)
@@ -76,7 +76,7 @@ class TypesTest < Test::Unit::TestCase
76
76
  assert_equal(-10000, types2.type8)
77
77
  assert_equal(10000, types2.type9)
78
78
  assert_equal(100000, types2.type10)
79
- assert types2.type11
79
+ assert(types2.type11)
80
80
  assert_equal('hello all types', types2.type12)
81
81
  assert_equal(10938, types2.type13.size)
82
82
  assert_equal(image_bin, types2.type13)
@@ -86,141 +86,141 @@ class TypesTest < Test::Unit::TestCase
86
86
 
87
87
  def test_parse
88
88
  types = Test::Types::TestTypes.new
89
- types.parse_from_file 'test/data/types.bin'
90
- assert_in_delta 0.01, types.type1, 0.00001
91
- assert_in_delta 0.1, types.type2, 0.00001
92
- assert_equal 1, types.type3
93
- assert_equal 10, types.type4
94
- assert_equal 100, types.type5
95
- assert_equal 1000, types.type6
89
+ types.parse_from_file('test/data/types.bin')
90
+ assert_in_delta(0.01, types.type1, 0.00001)
91
+ assert_in_delta(0.1, types.type2, 0.00001)
92
+ assert_equal(1, types.type3)
93
+ assert_equal(10, types.type4)
94
+ assert_equal(100, types.type5)
95
+ assert_equal(1000, types.type6)
96
96
  assert_equal(-1, types.type7)
97
97
  assert_equal(-10, types.type8)
98
- assert_equal 10000, types.type9
99
- assert_equal 100000, types.type10
100
- assert_equal false, !!types.type11
101
- assert_equal 'hello all types', types.type12
102
- assert_equal File.open('test/data/unk.png', 'r+b'){|f| f.read}, types.type13
98
+ assert_equal(10000, types.type9)
99
+ assert_equal(100000, types.type10)
100
+ assert_equal(false, !!types.type11)
101
+ assert_equal('hello all types', types.type12)
102
+ assert_equal(File.open('test/data/unk.png', 'r+b'){|f| f.read}, types.type13)
103
103
  end
104
104
 
105
105
  def test_double
106
106
  # double fixed 64-bit
107
107
  types = Test::Types::TestTypes.new
108
- assert_nothing_raised do types.type1 = 1 end
109
- assert_nothing_raised do types.type1 = 1.0 end
110
- assert_raise TypeError do types.type1 = '' end
111
- assert_nothing_raised do types.type1 = Protobuf::Field::DoubleField.max end
112
- assert_nothing_raised do types.type1 = Protobuf::Field::DoubleField.min end
108
+ assert_nothing_raised { types.type1 = 1 }
109
+ assert_nothing_raised { types.type1 = 1.0 }
110
+ assert_raise(TypeError) { types.type1 = '' }
111
+ assert_nothing_raised { types.type1 = Protobuf::Field::DoubleField.max }
112
+ assert_nothing_raised { types.type1 = Protobuf::Field::DoubleField.min }
113
113
  end
114
114
 
115
115
  def test_float
116
116
  # float fixed 32-bit
117
117
  types = Test::Types::TestTypes.new
118
- assert_nothing_raised do types.type2 = 1 end
119
- assert_nothing_raised do types.type2 = 1.0 end
120
- assert_raise TypeError do types.type2 = '' end
121
- assert_nothing_raised do types.type2 = Protobuf::Field::FloatField.max end
122
- assert_nothing_raised do types.type2 = Protobuf::Field::FloatField.min end
118
+ assert_nothing_raised { types.type2 = 1 }
119
+ assert_nothing_raised { types.type2 = 1.0 }
120
+ assert_raise(TypeError) { types.type2 = '' }
121
+ assert_nothing_raised { types.type2 = Protobuf::Field::FloatField.max }
122
+ assert_nothing_raised { types.type2 = Protobuf::Field::FloatField.min }
123
123
  end
124
124
 
125
125
  def test_int32
126
126
  types = Test::Types::TestTypes.new
127
- assert_nothing_raised do types.type3 = 1 end
128
- assert_nothing_raised do types.type3 = -1 end
129
- assert_raise TypeError do types.type3 = 1.0 end
130
- assert_raise TypeError do types.type3 = '' end
127
+ assert_nothing_raised { types.type3 = 1 }
128
+ assert_nothing_raised { types.type3 = -1 }
129
+ assert_raise(TypeError) { types.type3 = 1.0 }
130
+ assert_raise(TypeError) { types.type3 = '' }
131
131
  end
132
132
 
133
133
  def test_int64
134
134
  types = Test::Types::TestTypes.new
135
- assert_nothing_raised do types.type4 = 1 end
136
- assert_nothing_raised do types.type4 = -1 end
137
- assert_raise TypeError do types.type4 = 1.0 end
138
- assert_raise TypeError do types.type4 = '' end
135
+ assert_nothing_raised { types.type4 = 1 }
136
+ assert_nothing_raised { types.type4 = -1 }
137
+ assert_raise(TypeError) { types.type4 = 1.0 }
138
+ assert_raise(TypeError) { types.type4 = '' }
139
139
  end
140
140
 
141
141
  def test_uint32
142
142
  types = Test::Types::TestTypes.new
143
- assert_nothing_raised do types.type5 = 1 end
144
- assert_raise RangeError do types.type5 = -1 end
145
- assert_raise TypeError do types.type5 = 1.0 end
146
- assert_raise TypeError do types.type5 = '' end
143
+ assert_nothing_raised { types.type5 = 1 }
144
+ assert_raise(RangeError) { types.type5 = -1 }
145
+ assert_raise(TypeError) { types.type5 = 1.0 }
146
+ assert_raise(TypeError) { types.type5 = '' }
147
147
  end
148
148
 
149
149
  def test_uint64
150
150
  types = Test::Types::TestTypes.new
151
- assert_nothing_raised do types.type6 = 1 end
152
- assert_raise RangeError do types.type6 = -1 end
153
- assert_raise TypeError do types.type6 = 1.0 end
154
- assert_raise TypeError do types.type6 = '' end
151
+ assert_nothing_raised { types.type6 = 1 }
152
+ assert_raise(RangeError) { types.type6 = -1 }
153
+ assert_raise(TypeError) { types.type6 = 1.0 }
154
+ assert_raise(TypeError) { types.type6 = '' }
155
155
  end
156
156
 
157
157
  def test_sint32
158
158
  types = Test::Types::TestTypes.new
159
- assert_nothing_raised do types.type7 = 1 end
160
- assert_nothing_raised do types.type7 = -1 end
161
- assert_raise TypeError do types.type7 = 1.0 end
162
- assert_raise TypeError do types.type7 = '' end
159
+ assert_nothing_raised { types.type7 = 1 }
160
+ assert_nothing_raised { types.type7 = -1 }
161
+ assert_raise(TypeError) { types.type7 = 1.0 }
162
+ assert_raise(TypeError) { types.type7 = '' }
163
163
  end
164
164
 
165
165
  def test_sint64
166
166
  types = Test::Types::TestTypes.new
167
- assert_nothing_raised do types.type8 = 1 end
168
- assert_nothing_raised do types.type8 = -1 end
169
- assert_raise TypeError do types.type8 = 1.0 end
170
- assert_raise TypeError do types.type8 = '' end
167
+ assert_nothing_raised { types.type8 = 1 }
168
+ assert_nothing_raised { types.type8 = -1 }
169
+ assert_raise(TypeError) { types.type8 = 1.0 }
170
+ assert_raise(TypeError) { types.type8 = '' }
171
171
  end
172
172
 
173
173
  def test_fixed32
174
174
  types = Test::Types::TestTypes.new
175
- assert_nothing_raised do types.type9 = 1 end
176
- assert_raise TypeError do types.type9 = 1.0 end
177
- assert_raise TypeError do types.type9 = '' end
178
- assert_nothing_raised do types.type9 = Protobuf::Field::Fixed32Field.max end
179
- assert_raise RangeError do types.type9 = Protobuf::Field::Fixed32Field.max + 1 end
180
- assert_nothing_raised do types.type9 = Protobuf::Field::Fixed32Field.min end
181
- assert_raise RangeError do types.type9 = Protobuf::Field::Fixed32Field.min - 1 end
175
+ assert_nothing_raised { types.type9 = 1 }
176
+ assert_raise(TypeError) { types.type9 = 1.0 }
177
+ assert_raise(TypeError) { types.type9 = '' }
178
+ assert_nothing_raised { types.type9 = Protobuf::Field::Fixed32Field.max }
179
+ assert_raise(RangeError) { types.type9 = Protobuf::Field::Fixed32Field.max + 1 }
180
+ assert_nothing_raised { types.type9 = Protobuf::Field::Fixed32Field.min }
181
+ assert_raise(RangeError) { types.type9 = Protobuf::Field::Fixed32Field.min - 1 }
182
182
  end
183
183
 
184
184
  def test_fixed64
185
185
  types = Test::Types::TestTypes.new
186
- assert_nothing_raised do types.type10 = 1 end
187
- assert_raise TypeError do types.type10 = 1.0 end
188
- assert_raise TypeError do types.type10 = '' end
189
- assert_nothing_raised do types.type10 = Protobuf::Field::Fixed64Field.max end
190
- assert_raise RangeError do types.type10 = Protobuf::Field::Fixed64Field.max + 1 end
191
- assert_nothing_raised do types.type10 = Protobuf::Field::Fixed64Field.min end
192
- assert_raise RangeError do types.type10 = Protobuf::Field::Fixed64Field.min - 1 end
186
+ assert_nothing_raised { types.type10 = 1 }
187
+ assert_raise(TypeError) { types.type10 = 1.0 }
188
+ assert_raise(TypeError) { types.type10 = '' }
189
+ assert_nothing_raised { types.type10 = Protobuf::Field::Fixed64Field.max }
190
+ assert_raise(RangeError) { types.type10 = Protobuf::Field::Fixed64Field.max + 1 }
191
+ assert_nothing_raised { types.type10 = Protobuf::Field::Fixed64Field.min }
192
+ assert_raise(RangeError) { types.type10 = Protobuf::Field::Fixed64Field.min - 1 }
193
193
  end
194
194
 
195
195
  def test_bool
196
196
  types = Test::Types::TestTypes.new
197
- assert_nothing_raised do types.type11 = true end
198
- assert_nothing_raised do types.type11 = false end
199
- assert_nothing_raised do types.type11 = nil end
200
- assert_raise TypeError do types.type11 = 0 end
201
- assert_raise TypeError do types.type11 = '' end
197
+ assert_nothing_raised { types.type11 = true }
198
+ assert_nothing_raised { types.type11 = false }
199
+ assert_nothing_raised { types.type11 = nil }
200
+ assert_raise(TypeError) { types.type11 = 0 }
201
+ assert_raise(TypeError) { types.type11 = '' }
202
202
  end
203
203
 
204
204
  def test_string
205
205
  types = Test::Types::TestTypes.new
206
- assert_nothing_raised do types.type12 = '' end
207
- assert_nothing_raised do types.type12 = 'hello' end
208
- assert_nothing_raised do types.type12 = nil end
209
- assert_raise TypeError do types.type12 = 0 end
210
- assert_raise TypeError do types.type12 = true end
206
+ assert_nothing_raised { types.type12 = '' }
207
+ assert_nothing_raised { types.type12 = 'hello' }
208
+ assert_nothing_raised { types.type12 = nil }
209
+ assert_raise(TypeError) { types.type12 = 0 }
210
+ assert_raise(TypeError) { types.type12 = true }
211
211
  end
212
212
 
213
213
  def test_bytes
214
214
  types = Test::Types::TestTypes.new
215
- assert_nothing_raised do types.type13 = '' end
216
- assert_nothing_raised do types.type13 = 'hello' end
217
- assert_nothing_raised do types.type13 = nil end
218
- assert_raise TypeError do types.type13 = 0 end
219
- assert_raise TypeError do types.type13 = true end
220
- assert_raise TypeError do types.type13 = [] end
215
+ assert_nothing_raised { types.type13 = '' }
216
+ assert_nothing_raised { types.type13 = 'hello' }
217
+ assert_nothing_raised { types.type13 = nil }
218
+ assert_raise(TypeError) { types.type13 = 0 }
219
+ assert_raise(TypeError) { types.type13 = true }
220
+ assert_raise(TypeError) { types.type13 = [] }
221
221
  end
222
222
 
223
223
  def test_varint_getbytes
224
- assert_equal "\xac\x02", Protobuf::Field::VarintField.encode(300)
224
+ assert_equal("\xac\x02", Protobuf::Field::VarintField.encode(300))
225
225
  end
226
226
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 1
9
+ version: 0.4.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - MATSUYAMA Kengo
@@ -9,41 +14,33 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-07-10 00:00:00 +09:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.2.0
24
- version:
25
- description: "== DESCRIPTION: Protocol Buffers for Ruby. == FEATURES/PROBLEMS: * Compile .proto file to ruby script * Parse the binary wire format for protocol buffer * Serialize data to the binary wire format for protocol buffer"
26
- email:
27
- - macksx@gmail.com
17
+ date: 2010-04-30 00:00:00 +09:00
18
+ default_executable: rprotoc
19
+ dependencies: []
20
+
21
+ description: Ruby implementation for Protocol Buffers.
22
+ email: macksx@gmail.com
28
23
  executables:
29
24
  - rprotoc
30
25
  extensions: []
31
26
 
32
27
  extra_rdoc_files:
33
- - History.txt
34
- - Manifest.txt
35
28
  - README.txt
29
+ - TODO
36
30
  files:
37
31
  - History.txt
38
32
  - Manifest.txt
39
33
  - README.txt
40
34
  - Rakefile
41
- - script/mk_parser
35
+ - TODO
36
+ - VERSION
42
37
  - bin/rprotoc
43
- - examples/addressbook.proto
44
38
  - examples/addressbook.pb.rb
39
+ - examples/addressbook.proto
45
40
  - examples/reading_a_message.rb
46
41
  - examples/writing_a_message.rb
42
+ - lib/protobuf/common/exceptions.rb
43
+ - lib/protobuf/common/util.rb
47
44
  - lib/protobuf/common/wire_type.rb
48
45
  - lib/protobuf/compiler/compiler.rb
49
46
  - lib/protobuf/compiler/nodes.rb
@@ -73,78 +70,111 @@ files:
73
70
  - lib/protobuf/rpc/handler.rb
74
71
  - lib/protobuf/rpc/server.rb
75
72
  - lib/ruby_protobuf.rb
76
- - test/addressbook.rb
77
- - test/addressbook_base.rb
78
- - test/addressbook_ext.rb
73
+ - script/mk_parser
79
74
  - test/check_unbuild.rb
80
- - test/collision.rb
81
75
  - test/data/data.bin
82
76
  - test/data/data_source.py
83
77
  - test/data/types.bin
84
78
  - test/data/types_source.py
85
79
  - test/data/unk.png
86
- - test/ext_collision.rb
87
- - test/ext_range.rb
88
- - test/merge.rb
89
- - test/nested.rb
80
+ - test/proto/addressbook.pb.rb
90
81
  - test/proto/addressbook.proto
82
+ - test/proto/addressbook_base.pb.rb
91
83
  - test/proto/addressbook_base.proto
84
+ - test/proto/addressbook_ext.pb.rb
92
85
  - test/proto/addressbook_ext.proto
86
+ - test/proto/collision.pb.rb
93
87
  - test/proto/collision.proto
88
+ - test/proto/ext_collision.pb.rb
94
89
  - test/proto/ext_collision.proto
90
+ - test/proto/ext_range.pb.rb
95
91
  - test/proto/ext_range.proto
92
+ - test/proto/float_default.proto
93
+ - test/proto/lowercase.pb.rb
94
+ - test/proto/lowercase.proto
95
+ - test/proto/merge.pb.rb
96
96
  - test/proto/merge.proto
97
+ - test/proto/nested.pb.rb
97
98
  - test/proto/nested.proto
99
+ - test/proto/optional_field.pb.rb
100
+ - test/proto/optional_field.proto
101
+ - test/proto/packed.pb.rb
102
+ - test/proto/packed.proto
98
103
  - test/proto/rpc.proto
104
+ - test/proto/types.pb.rb
99
105
  - test/proto/types.proto
100
106
  - test/test_addressbook.rb
101
107
  - test/test_compiler.rb
102
108
  - test/test_descriptor.rb
109
+ - test/test_enum_value.rb
103
110
  - test/test_extension.rb
111
+ - test/test_lowercase.rb
104
112
  - test/test_message.rb
113
+ - test/test_optional_field.rb
114
+ - test/test_packed_field.rb
105
115
  - test/test_parse.rb
106
- - test/test_ruby_protobuf.rb
116
+ - test/test_repeated_types.rb
107
117
  - test/test_serialize.rb
108
118
  - test/test_standard_message.rb
109
119
  - test/test_types.rb
110
- - test/types.rb
111
120
  has_rdoc: true
112
121
  homepage: http://code.google.com/p/ruby-protobuf
122
+ licenses: []
123
+
113
124
  post_install_message:
114
125
  rdoc_options:
115
- - --main
116
- - README.txt
126
+ - --charset=UTF-8
117
127
  require_paths:
118
128
  - lib
119
129
  required_ruby_version: !ruby/object:Gem::Requirement
120
130
  requirements:
121
131
  - - ">="
122
132
  - !ruby/object:Gem::Version
133
+ segments:
134
+ - 0
123
135
  version: "0"
124
- version:
125
136
  required_rubygems_version: !ruby/object:Gem::Requirement
126
137
  requirements:
127
138
  - - ">="
128
139
  - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
129
142
  version: "0"
130
- version:
131
143
  requirements: []
132
144
 
133
- rubyforge_project: ruby-protobuf
134
- rubygems_version: 1.3.1
145
+ rubyforge_project:
146
+ rubygems_version: 1.3.6
135
147
  signing_key:
136
- specification_version: 2
148
+ specification_version: 3
137
149
  summary: Protocol Buffers for Ruby
138
150
  test_files:
151
+ - test/check_unbuild.rb
139
152
  - test/test_descriptor.rb
140
153
  - test/test_optional_field.rb
154
+ - test/proto/merge.pb.rb
155
+ - test/proto/ext_collision.pb.rb
156
+ - test/proto/lowercase.pb.rb
157
+ - test/proto/addressbook_base.pb.rb
158
+ - test/proto/packed.pb.rb
159
+ - test/proto/optional_field.pb.rb
160
+ - test/proto/addressbook.pb.rb
161
+ - test/proto/addressbook_ext.pb.rb
162
+ - test/proto/nested.pb.rb
163
+ - test/proto/ext_range.pb.rb
164
+ - test/proto/types.pb.rb
165
+ - test/proto/collision.pb.rb
166
+ - test/test_enum_value.rb
141
167
  - test/test_repeated_types.rb
142
168
  - test/test_types.rb
143
169
  - test/test_extension.rb
144
170
  - test/test_serialize.rb
145
171
  - test/test_standard_message.rb
172
+ - test/test_packed_field.rb
173
+ - test/test_lowercase.rb
146
174
  - test/test_compiler.rb
147
175
  - test/test_message.rb
148
176
  - test/test_parse.rb
149
177
  - test/test_addressbook.rb
150
- - test/test_ruby_protobuf.rb
178
+ - examples/writing_a_message.rb
179
+ - examples/reading_a_message.rb
180
+ - examples/addressbook.pb.rb
data/test/addressbook.rb DELETED
@@ -1,98 +0,0 @@
1
- ### Generated by rprotoc. DO NOT EDIT!
2
- ### <proto file: test/addressbook.proto>
3
- # package tutorial;
4
- #
5
- # message Person {
6
- # required string name = 1;
7
- # required int32 id = 2;
8
- # optional string email = 3;
9
- #
10
- # enum PhoneType {
11
- # MOBILE = 0;
12
- # HOME = 1;
13
- # WORK = 2;
14
- # }
15
- #
16
- # message PhoneNumber {
17
- # required string number = 1;
18
- # optional PhoneType type = 2 [default = HOME];
19
- # }
20
- #
21
- # repeated PhoneNumber phone = 4;
22
- #
23
- # extensions 100 to 200;
24
- # }
25
- #
26
- # extend Person {
27
- # optional int32 age = 100;
28
- # }
29
- #
30
- # message AddressBook {
31
- # repeated Person person = 1;
32
- # }
33
- require 'protobuf/message/message'
34
- require 'protobuf/message/enum'
35
- require 'protobuf/message/service'
36
- require 'protobuf/message/extend'
37
-
38
- module Tutorial
39
-
40
- class Person < ::Protobuf::Message
41
- defined_in __FILE__
42
- required :string, :name, 1
43
- required :int32, :id, 2
44
- optional :string, :email, 3
45
-
46
- class PhoneType < ::Protobuf::Enum
47
- defined_in __FILE__
48
- MOBILE = 0
49
- HOME = 1
50
- WORK = 2
51
- end
52
-
53
- class PhoneNumber < ::Protobuf::Message
54
- defined_in __FILE__
55
- required :string, :number, 1
56
- optional :PhoneType, :type, 2, {:default => :HOME}
57
- end
58
-
59
- repeated :PhoneNumber, :phone, 4
60
-
61
- #extensions 100..200
62
- end
63
-
64
- # see: addressbool_ext.rb
65
- #class Person < ::Protobuf::Message
66
- # optional :int32, :age, 100, :extension => true
67
- #end
68
-
69
- class AddressBook < ::Protobuf::Message
70
- defined_in __FILE__
71
- repeated :Person, :person, 1
72
- end
73
-
74
- #class SearchService < Protobuf::Service
75
- # rpc :Search, :request => :SearchRequest, :response => :SearchResponse
76
- #end
77
-
78
- #Protobuf::OPTIONS[:optimize_for] = :SPEED
79
- #Protobuf::OPTIONS[:java_package] = :'com.example.foo'
80
- end
81
-
82
- =begin
83
- tutorial = Object.const_set :Tutorial, Module.new
84
- person = tutorial.const_set :Person, Class.new(Protobuf::Message)
85
- person.required :string, :name, 1
86
- person.required :int32, :id, 2
87
- person.optional :string, :email, 3
88
- phone_type = person.const_set :PhoneType, Class.new(Protobuf::Enum)
89
- phone_type.const_set :MOBILE, 0
90
- phone_type.const_set :HOME, 1
91
- phone_type.const_set :WORK, 2
92
- phone_number = person.const_set :PhoneNumber, Class.new(Protobuf::Message)
93
- phone_number.required :string, :number, 1
94
- phone_number.optional :PhoneType, :type, 2, {:default => :HOME}
95
- person.repeated :PhoneNumber, :phone, 4
96
- address_book = tutorial.const_set :AddressBook, Class.new(Protobuf::Message)
97
- address_book.repeated :Person, :person, 1
98
- =end
@@ -1,62 +0,0 @@
1
- require 'protobuf/message/message'
2
- require 'protobuf/message/enum'
3
- require 'protobuf/message/service'
4
- require 'protobuf/message/extend'
5
-
6
- module TutorialExt
7
-
8
- class Person < ::Protobuf::Message
9
- required :string, :name, 1
10
- required :int32, :id, 2
11
- optional :string, :email, 3
12
-
13
- class PhoneType < ::Protobuf::Enum
14
- MOBILE = 0
15
- HOME = 1
16
- WORK = 2
17
- end
18
-
19
- class PhoneNumber < ::Protobuf::Message
20
- required :string, :number, 1
21
- optional :PhoneType, :type, 2, {:default => :HOME}
22
- end
23
-
24
- repeated :PhoneNumber, :phone, 4
25
-
26
- extensions 100..200
27
- end
28
-
29
- # see: addressbool_ext.rb
30
- #class Person < ::Protobuf::Message
31
- # optional :int32, :age, 100, :extension => true
32
- #end
33
-
34
- class AddressBook < ::Protobuf::Message
35
- repeated :Person, :person, 1
36
- end
37
-
38
- #class SearchService < Protobuf::Service
39
- # rpc :Search => :SearchRequest, :returns => :SearchResponse
40
- #end
41
-
42
- #Protobuf::OPTIONS[:optimize_for] = :SPEED
43
- #Protobuf::OPTIONS[:java_package] = :'com.example.foo'
44
- end
45
-
46
- =begin
47
- tutorial = Object.const_set :Tutorial, Module.new
48
- person = tutorial.const_set :Person, Class.new(Protobuf::Message)
49
- person.required :string, :name, 1
50
- person.required :int32, :id, 2
51
- person.optional :string, :email, 3
52
- phone_type = person.const_set :PhoneType, Class.new(Protobuf::Enum)
53
- phone_type.const_set :MOBILE, 0
54
- phone_type.const_set :HOME, 1
55
- phone_type.const_set :WORK, 2
56
- phone_number = person.const_set :PhoneNumber, Class.new(Protobuf::Message)
57
- phone_number.required :string, :number, 1
58
- phone_number.optional :PhoneType, :type, 2, {:default => :HOME}
59
- person.repeated :PhoneNumber, :phone, 4
60
- address_book = tutorial.const_set :AddressBook, Class.new(Protobuf::Message)
61
- address_book.repeated :Person, :person, 1
62
- =end
@@ -1,12 +0,0 @@
1
- require 'protobuf/message/message'
2
- require 'protobuf/message/enum'
3
- require 'protobuf/message/service'
4
- require 'protobuf/message/extend'
5
-
6
- require 'addressbook_base'
7
-
8
- module TutorialExt
9
- class Person < ::Protobuf::Message
10
- optional :int32, :age, 100, :extension => true
11
- end
12
- end