ruby-protocol-buffers 1.0.1 → 1.1.0
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.
- data/VERSION +1 -1
- data/lib/protocol_buffers/compiler/file_descriptor_to_ruby.rb +0 -4
- data/lib/protocol_buffers/runtime/message.rb +2 -3
- data/spec/runtime_spec.rb +20 -12
- metadata +62 -96
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0
|
|
1
|
+
1.1.0
|
|
@@ -29,10 +29,6 @@ HEADER
|
|
|
29
29
|
@io.write("\n") unless descriptor.dependency.empty?
|
|
30
30
|
|
|
31
31
|
# in_namespace correctly handles the case where @package.nil?
|
|
32
|
-
unless @package.empty?
|
|
33
|
-
@io.write("# Reload support\nObject.__send__(:remove_const, :#{@package}) if defined?(#{@package})\n\n")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
32
|
in_namespace("module", @package) do
|
|
37
33
|
declare(descriptor.message_type, descriptor.enum_type)
|
|
38
34
|
|
|
@@ -213,9 +213,8 @@ module ProtocolBuffers
|
|
|
213
213
|
# end
|
|
214
214
|
#
|
|
215
215
|
# An exception will be thrown if an enum field is assigned a value not in the
|
|
216
|
-
# enum.
|
|
217
|
-
#
|
|
218
|
-
# tag number.
|
|
216
|
+
# enum. If an unknown enum value is found while parsing a message, this is
|
|
217
|
+
# treated like an unknown tag id. This matches the C++ library behavior.
|
|
219
218
|
#
|
|
220
219
|
# == Extensions
|
|
221
220
|
#
|
data/spec/runtime_spec.rb
CHANGED
|
@@ -8,6 +8,14 @@ require 'protocol_buffers/compiler'
|
|
|
8
8
|
|
|
9
9
|
describe ProtocolBuffers, "runtime" do
|
|
10
10
|
before(:each) do
|
|
11
|
+
# clear our namespaces
|
|
12
|
+
Object.send(:remove_const, :Simple) if defined?(Simple)
|
|
13
|
+
Object.send(:remove_const, :Featureful) if defined?(Featureful)
|
|
14
|
+
Object.send(:remove_const, :Foo) if defined?(Foo)
|
|
15
|
+
Object.send(:remove_const, :TehUnknown) if defined?(TehUnknown)
|
|
16
|
+
Object.send(:remove_const, :TehUnknown2) if defined?(TehUnknown2)
|
|
17
|
+
Object.send(:remove_const, :TehUnknown3) if defined?(TehUnknown3)
|
|
18
|
+
|
|
11
19
|
ProtocolBuffers::Compiler.compile_and_load(
|
|
12
20
|
File.join(File.dirname(__FILE__), "proto_files", "simple.proto"))
|
|
13
21
|
ProtocolBuffers::Compiler.compile_and_load(
|
|
@@ -341,14 +349,14 @@ describe ProtocolBuffers, "runtime" do
|
|
|
341
349
|
|
|
342
350
|
# now make field_1 required
|
|
343
351
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
344
|
-
package
|
|
352
|
+
package tehUnknown2;
|
|
345
353
|
message MyResult {
|
|
346
354
|
required string field_1 = 1;
|
|
347
355
|
optional string field_2 = 2;
|
|
348
356
|
}
|
|
349
357
|
EOS
|
|
350
358
|
|
|
351
|
-
proc {
|
|
359
|
+
proc { TehUnknown2::MyResult.parse(buf) }.should raise_error(ProtocolBuffers::DecodeError)
|
|
352
360
|
end
|
|
353
361
|
|
|
354
362
|
it "enforces valid values on deserialization" do
|
|
@@ -363,13 +371,13 @@ describe ProtocolBuffers, "runtime" do
|
|
|
363
371
|
buf = res1.to_s
|
|
364
372
|
|
|
365
373
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
366
|
-
package
|
|
374
|
+
package tehUnknown2;
|
|
367
375
|
message MyResult {
|
|
368
376
|
optional int32 field_1 = 1;
|
|
369
377
|
}
|
|
370
378
|
EOS
|
|
371
379
|
|
|
372
|
-
proc {
|
|
380
|
+
proc { TehUnknown2::MyResult.parse(buf) }.should raise_error(ProtocolBuffers::DecodeError)
|
|
373
381
|
end
|
|
374
382
|
|
|
375
383
|
it "ignores and passes on unknown fields" do
|
|
@@ -389,7 +397,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
389
397
|
|
|
390
398
|
# remove field_2 to pretend we never knew about it
|
|
391
399
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
392
|
-
package
|
|
400
|
+
package tehUnknown2;
|
|
393
401
|
message MyResult {
|
|
394
402
|
optional int32 field_1 = 1;
|
|
395
403
|
optional int32 field_3 = 3;
|
|
@@ -398,7 +406,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
398
406
|
|
|
399
407
|
res2 = nil
|
|
400
408
|
proc do
|
|
401
|
-
res2 =
|
|
409
|
+
res2 = TehUnknown2::MyResult.parse(serialized)
|
|
402
410
|
end.should_not raise_error()
|
|
403
411
|
|
|
404
412
|
res2.field_1.should == 0xffff
|
|
@@ -412,7 +420,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
412
420
|
|
|
413
421
|
# now we know about field_2 again
|
|
414
422
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
415
|
-
package
|
|
423
|
+
package tehUnknown3;
|
|
416
424
|
message MyResult {
|
|
417
425
|
optional int32 field_1 = 1;
|
|
418
426
|
optional int32 field_2 = 2;
|
|
@@ -420,7 +428,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
420
428
|
}
|
|
421
429
|
EOS
|
|
422
430
|
|
|
423
|
-
res3 =
|
|
431
|
+
res3 = TehUnknown3::MyResult.parse(serialized2)
|
|
424
432
|
res3.field_1.should == 0xffff
|
|
425
433
|
|
|
426
434
|
res3.field_2.should == 0xfffe
|
|
@@ -444,7 +452,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
444
452
|
|
|
445
453
|
# remove field_2 to pretend we never knew about it
|
|
446
454
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
447
|
-
package
|
|
455
|
+
package tehUnknown2;
|
|
448
456
|
message MyResult {
|
|
449
457
|
enum E {
|
|
450
458
|
V1 = 1;
|
|
@@ -455,7 +463,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
455
463
|
|
|
456
464
|
res2 = nil
|
|
457
465
|
proc do
|
|
458
|
-
res2 =
|
|
466
|
+
res2 = TehUnknown2::MyResult.parse(serialized)
|
|
459
467
|
end.should_not raise_error()
|
|
460
468
|
|
|
461
469
|
res2.value_for_tag?(1).should be_false
|
|
@@ -465,7 +473,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
465
473
|
|
|
466
474
|
# now we know about field_2 again
|
|
467
475
|
ProtocolBuffers::Compiler.compile_and_load_string <<-EOS
|
|
468
|
-
package
|
|
476
|
+
package tehUnknown3;
|
|
469
477
|
message MyResult {
|
|
470
478
|
enum E {
|
|
471
479
|
V1 = 1;
|
|
@@ -475,7 +483,7 @@ describe ProtocolBuffers, "runtime" do
|
|
|
475
483
|
}
|
|
476
484
|
EOS
|
|
477
485
|
|
|
478
|
-
res3 =
|
|
486
|
+
res3 = TehUnknown3::MyResult.parse(serialized2)
|
|
479
487
|
res3.field_1.should == 2
|
|
480
488
|
end
|
|
481
489
|
|
metadata
CHANGED
|
@@ -1,104 +1,80 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-protocol-buffers
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
prerelease:
|
|
6
|
-
segments:
|
|
7
|
-
- 1
|
|
8
|
-
- 0
|
|
9
|
-
- 1
|
|
10
|
-
version: 1.0.1
|
|
11
6
|
platform: ruby
|
|
12
|
-
authors:
|
|
7
|
+
authors:
|
|
13
8
|
- Brian Palmer
|
|
14
9
|
autorequire:
|
|
15
10
|
bindir: bin
|
|
16
11
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies:
|
|
21
|
-
- !ruby/object:Gem::Dependency
|
|
12
|
+
date: 2011-09-20 00:00:00.000000000Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
22
15
|
name: rspec
|
|
23
|
-
|
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
|
16
|
+
requirement: &70109784526400 !ruby/object:Gem::Requirement
|
|
25
17
|
none: false
|
|
26
|
-
requirements:
|
|
18
|
+
requirements:
|
|
27
19
|
- - ~>
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
|
|
30
|
-
segments:
|
|
31
|
-
- 2
|
|
32
|
-
- 5
|
|
33
|
-
version: "2.5"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '2.5'
|
|
34
22
|
type: :development
|
|
35
|
-
version_requirements: *id001
|
|
36
|
-
- !ruby/object:Gem::Dependency
|
|
37
|
-
name: autotest-standalone
|
|
38
23
|
prerelease: false
|
|
39
|
-
|
|
24
|
+
version_requirements: *70109784526400
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: autotest-standalone
|
|
27
|
+
requirement: &70109784526000 !ruby/object:Gem::Requirement
|
|
40
28
|
none: false
|
|
41
|
-
requirements:
|
|
42
|
-
- -
|
|
43
|
-
- !ruby/object:Gem::Version
|
|
44
|
-
|
|
45
|
-
segments:
|
|
46
|
-
- 0
|
|
47
|
-
version: "0"
|
|
29
|
+
requirements:
|
|
30
|
+
- - ! '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
48
33
|
type: :development
|
|
49
|
-
version_requirements: *id002
|
|
50
|
-
- !ruby/object:Gem::Dependency
|
|
51
|
-
name: autotest-growl
|
|
52
34
|
prerelease: false
|
|
53
|
-
|
|
35
|
+
version_requirements: *70109784526000
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: autotest-growl
|
|
38
|
+
requirement: &70109784525540 !ruby/object:Gem::Requirement
|
|
54
39
|
none: false
|
|
55
|
-
requirements:
|
|
56
|
-
- -
|
|
57
|
-
- !ruby/object:Gem::Version
|
|
58
|
-
|
|
59
|
-
segments:
|
|
60
|
-
- 0
|
|
61
|
-
version: "0"
|
|
40
|
+
requirements:
|
|
41
|
+
- - ! '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
62
44
|
type: :development
|
|
63
|
-
version_requirements: *id003
|
|
64
|
-
- !ruby/object:Gem::Dependency
|
|
65
|
-
name: rcov
|
|
66
45
|
prerelease: false
|
|
67
|
-
|
|
46
|
+
version_requirements: *70109784525540
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: rcov
|
|
49
|
+
requirement: &70109784525120 !ruby/object:Gem::Requirement
|
|
68
50
|
none: false
|
|
69
|
-
requirements:
|
|
70
|
-
- -
|
|
71
|
-
- !ruby/object:Gem::Version
|
|
72
|
-
|
|
73
|
-
segments:
|
|
74
|
-
- 0
|
|
75
|
-
version: "0"
|
|
51
|
+
requirements:
|
|
52
|
+
- - ! '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
76
55
|
type: :development
|
|
77
|
-
version_requirements: *id004
|
|
78
|
-
- !ruby/object:Gem::Dependency
|
|
79
|
-
name: yard
|
|
80
56
|
prerelease: false
|
|
81
|
-
|
|
57
|
+
version_requirements: *70109784525120
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
59
|
+
name: yard
|
|
60
|
+
requirement: &70109784524700 !ruby/object:Gem::Requirement
|
|
82
61
|
none: false
|
|
83
|
-
requirements:
|
|
84
|
-
- -
|
|
85
|
-
- !ruby/object:Gem::Version
|
|
86
|
-
|
|
87
|
-
segments:
|
|
88
|
-
- 0
|
|
89
|
-
version: "0"
|
|
62
|
+
requirements:
|
|
63
|
+
- - ! '>='
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
90
66
|
type: :development
|
|
91
|
-
|
|
67
|
+
prerelease: false
|
|
68
|
+
version_requirements: *70109784524700
|
|
92
69
|
description:
|
|
93
|
-
email:
|
|
70
|
+
email:
|
|
94
71
|
- brian@codekitchen.net
|
|
95
|
-
executables:
|
|
72
|
+
executables:
|
|
96
73
|
- ruby-protoc
|
|
97
74
|
extensions: []
|
|
98
|
-
|
|
99
|
-
extra_rdoc_files:
|
|
75
|
+
extra_rdoc_files:
|
|
100
76
|
- Changelog.md
|
|
101
|
-
files:
|
|
77
|
+
files:
|
|
102
78
|
- .document
|
|
103
79
|
- .gitignore
|
|
104
80
|
- Changelog.md
|
|
@@ -143,41 +119,31 @@ files:
|
|
|
143
119
|
- spec/runtime_spec.rb
|
|
144
120
|
- spec/spec.opts
|
|
145
121
|
- spec/spec_helper.rb
|
|
146
|
-
has_rdoc: true
|
|
147
122
|
homepage: https://github.com/mozy/ruby-protocol-buffers
|
|
148
123
|
licenses: []
|
|
149
|
-
|
|
150
124
|
post_install_message:
|
|
151
125
|
rdoc_options: []
|
|
152
|
-
|
|
153
|
-
require_paths:
|
|
126
|
+
require_paths:
|
|
154
127
|
- lib
|
|
155
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
129
|
none: false
|
|
157
|
-
requirements:
|
|
158
|
-
- -
|
|
159
|
-
- !ruby/object:Gem::Version
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- 0
|
|
163
|
-
version: "0"
|
|
164
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ! '>='
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
135
|
none: false
|
|
166
|
-
requirements:
|
|
167
|
-
- -
|
|
168
|
-
- !ruby/object:Gem::Version
|
|
169
|
-
|
|
170
|
-
segments:
|
|
171
|
-
- 0
|
|
172
|
-
version: "0"
|
|
136
|
+
requirements:
|
|
137
|
+
- - ! '>='
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: '0'
|
|
173
140
|
requirements: []
|
|
174
|
-
|
|
175
141
|
rubyforge_project:
|
|
176
|
-
rubygems_version: 1.
|
|
142
|
+
rubygems_version: 1.8.10
|
|
177
143
|
signing_key:
|
|
178
144
|
specification_version: 3
|
|
179
145
|
summary: Ruby compiler and runtime for the google protocol buffers library.
|
|
180
|
-
test_files:
|
|
146
|
+
test_files:
|
|
181
147
|
- spec/compiler_spec.rb
|
|
182
148
|
- spec/fields_spec.rb
|
|
183
149
|
- spec/proto_files/depends.proto
|