ruby_protobuf 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/protobuf/common/util.rb +1 -1
- data/lib/protobuf/compiler/proto.y +1 -1
- data/lib/protobuf/compiler/proto_parser.rb +1 -1
- data/lib/protobuf/compiler/visitors.rb +2 -3
- data/test/proto/float_default.pb.rb +28 -0
- data/test/test_enum_value.rb +2 -2
- metadata +32 -25
data/History.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
=== 0.4.
|
1
|
+
=== 0.4.7 / 2010-09-28
|
2
2
|
|
3
|
+
* 0.4.7
|
4
|
+
* Bug fixes.
|
5
|
+
* Compilation error for importing message.
|
6
|
+
* Fixes for Ruby 1.9.2
|
7
|
+
* Compilation problem of string literals.
|
3
8
|
* 0.4.6
|
4
9
|
* Implement Message#to_hash method.
|
5
10
|
* Accept String value for enum fields.
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ end
|
|
20
20
|
|
21
21
|
require 'rake/testtask'
|
22
22
|
Rake::TestTask.new(:test) do |test|
|
23
|
-
test.libs << '
|
23
|
+
test.libs << 'test:.'
|
24
24
|
test.pattern = 'test/**/test_*.rb'
|
25
25
|
test.verbose = true
|
26
26
|
end
|
@@ -28,13 +28,13 @@ end
|
|
28
28
|
begin
|
29
29
|
require 'rcov/rcovtask'
|
30
30
|
Rcov::RcovTask.new do |test|
|
31
|
-
test.libs << 'test'
|
31
|
+
test.libs << 'test:.'
|
32
32
|
test.pattern = 'test/**/test_*.rb'
|
33
33
|
test.verbose = true
|
34
34
|
end
|
35
35
|
rescue LoadError
|
36
36
|
task :rcov do
|
37
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install rcov"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.7
|
data/lib/protobuf/common/util.rb
CHANGED
@@ -193,7 +193,7 @@ end
|
|
193
193
|
yield [:OCT_INTEGER, @token.to_i(0)]
|
194
194
|
when match(/(true|false)\b/)
|
195
195
|
yield [:BOOLEAN_LITERAL, @token == 'true']
|
196
|
-
when match(/"(?:[^"\\]
|
196
|
+
when match(/"(?:[^"\\]|\\.)*"/, /'(?:[^'\\]|\\.)*'/)
|
197
197
|
yield [:STRING_LITERAL, eval(@token)]
|
198
198
|
when match(/[a-zA-Z_]\w*/)
|
199
199
|
yield [:IDENT, @token.to_sym]
|
@@ -498,7 +498,7 @@ module_eval <<'..end lib/protobuf/compiler/proto.y modeval..idf83c19ba1e', 'lib/
|
|
498
498
|
yield [:OCT_INTEGER, @token.to_i(0)]
|
499
499
|
when match(/(true|false)\b/)
|
500
500
|
yield [:BOOLEAN_LITERAL, @token == 'true']
|
501
|
-
when match(/"(?:[^"\\]
|
501
|
+
when match(/"(?:[^"\\]|\\.)*"/, /'(?:[^'\\]|\\.)*'/)
|
502
502
|
yield [:STRING_LITERAL, eval(@token)]
|
503
503
|
when match(/[a-zA-Z_]\w*/)
|
504
504
|
yield [:IDENT, @token.to_sym]
|
@@ -99,11 +99,10 @@ module Protobuf
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def required_message_from_proto(proto_file)
|
102
|
-
|
103
|
-
unless File.exist?("#{@out_dir}/#{rb_path}")
|
102
|
+
unless File.exist?(File.join(@out_dir, File.basename(proto_file, '.proto') + '.pb.rb'))
|
104
103
|
Compiler.compile(proto_file, @proto_dir, @out_dir)
|
105
104
|
end
|
106
|
-
|
105
|
+
proto_file.sub(/\.proto\z/, '')
|
107
106
|
end
|
108
107
|
|
109
108
|
def create_files(filename, out_dir, file_create)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
### Generated by rprotoc. DO NOT EDIT!
|
2
|
+
### <proto file: test/proto/float_default.proto>
|
3
|
+
# message M {
|
4
|
+
# optional float f = 1 [default = 4.2];
|
5
|
+
# optional float g = 2 [default = -4.2];
|
6
|
+
# optional float h = 3 [default = 4352];
|
7
|
+
# optional float i = 4 [default = 23145.2 ];
|
8
|
+
# optional float j = 5 [default = -5 ];
|
9
|
+
# optional float k = 6 [default = +23 ];
|
10
|
+
# optional float l = 7 [default = +23.42 ];
|
11
|
+
# }
|
12
|
+
#
|
13
|
+
|
14
|
+
require 'protobuf/message/message'
|
15
|
+
require 'protobuf/message/enum'
|
16
|
+
require 'protobuf/message/service'
|
17
|
+
require 'protobuf/message/extend'
|
18
|
+
|
19
|
+
class M < ::Protobuf::Message
|
20
|
+
defined_in __FILE__
|
21
|
+
optional :float, :f, 1, :default => 4.2
|
22
|
+
optional :float, :g, 2, :default => -4.2
|
23
|
+
optional :float, :h, 3, :default => 4352
|
24
|
+
optional :float, :i, 4, :default => 23145.2
|
25
|
+
optional :float, :j, 5, :default => -5
|
26
|
+
optional :float, :k, 6, :default => 23
|
27
|
+
optional :float, :l, 7, :default => 23.42
|
28
|
+
end
|
data/test/test_enum_value.rb
CHANGED
@@ -14,8 +14,8 @@ class EnumValueTest < Test::Unit::TestCase
|
|
14
14
|
assert_equal('name', "#{e}")
|
15
15
|
assert(e == 100)
|
16
16
|
assert(100 == e)
|
17
|
-
|
18
|
-
|
17
|
+
assert_equal(101, e + 1)
|
18
|
+
assert_equal(101, 1 + e)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_enum_field_and_enum_value
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- MATSUYAMA Kengo
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-28 00:00:00 +09:00
|
18
19
|
default_executable: rprotoc
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -116,6 +117,7 @@ files:
|
|
116
117
|
- test/test_serialize.rb
|
117
118
|
- test/test_standard_message.rb
|
118
119
|
- test/test_types.rb
|
120
|
+
- test/proto/float_default.pb.rb
|
119
121
|
has_rdoc: true
|
120
122
|
homepage: http://code.google.com/p/ruby-protobuf
|
121
123
|
licenses: []
|
@@ -126,54 +128,59 @@ rdoc_options:
|
|
126
128
|
require_paths:
|
127
129
|
- lib
|
128
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
129
132
|
requirements:
|
130
133
|
- - ">="
|
131
134
|
- !ruby/object:Gem::Version
|
135
|
+
hash: 3
|
132
136
|
segments:
|
133
137
|
- 0
|
134
138
|
version: "0"
|
135
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
136
141
|
requirements:
|
137
142
|
- - ">="
|
138
143
|
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
139
145
|
segments:
|
140
146
|
- 0
|
141
147
|
version: "0"
|
142
148
|
requirements: []
|
143
149
|
|
144
150
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.3.
|
151
|
+
rubygems_version: 1.3.7
|
146
152
|
signing_key:
|
147
153
|
specification_version: 3
|
148
154
|
summary: Protocol Buffers for Ruby
|
149
155
|
test_files:
|
150
|
-
- test/check_unbuild.rb
|
151
|
-
- test/test_descriptor.rb
|
152
|
-
- test/test_optional_field.rb
|
153
|
-
- test/proto/merge.pb.rb
|
154
|
-
- test/proto/ext_collision.pb.rb
|
155
|
-
- test/proto/lowercase.pb.rb
|
156
|
-
- test/proto/addressbook_base.pb.rb
|
157
156
|
- test/proto/packed.pb.rb
|
158
|
-
- test/proto/
|
157
|
+
- test/proto/types.pb.rb
|
159
158
|
- test/proto/addressbook.pb.rb
|
160
|
-
- test/proto/addressbook_ext.pb.rb
|
161
|
-
- test/proto/nested.pb.rb
|
162
159
|
- test/proto/ext_range.pb.rb
|
163
|
-
- test/proto/
|
160
|
+
- test/proto/nested.pb.rb
|
161
|
+
- test/proto/addressbook_base.pb.rb
|
164
162
|
- test/proto/collision.pb.rb
|
165
|
-
- test/
|
166
|
-
- test/
|
167
|
-
- test/
|
168
|
-
- test/
|
169
|
-
- test/
|
170
|
-
- test/
|
171
|
-
- test/test_packed_field.rb
|
172
|
-
- test/test_lowercase.rb
|
163
|
+
- test/proto/optional_field.pb.rb
|
164
|
+
- test/proto/merge.pb.rb
|
165
|
+
- test/proto/addressbook_ext.pb.rb
|
166
|
+
- test/proto/float_default.pb.rb
|
167
|
+
- test/proto/lowercase.pb.rb
|
168
|
+
- test/proto/ext_collision.pb.rb
|
173
169
|
- test/test_compiler.rb
|
174
|
-
- test/test_message.rb
|
175
170
|
- test/test_parse.rb
|
176
171
|
- test/test_addressbook.rb
|
172
|
+
- test/test_extension.rb
|
173
|
+
- test/test_lowercase.rb
|
174
|
+
- test/test_standard_message.rb
|
175
|
+
- test/test_enum_value.rb
|
176
|
+
- test/test_message.rb
|
177
|
+
- test/test_types.rb
|
178
|
+
- test/test_repeated_types.rb
|
179
|
+
- test/test_descriptor.rb
|
180
|
+
- test/test_optional_field.rb
|
181
|
+
- test/test_packed_field.rb
|
182
|
+
- test/test_serialize.rb
|
183
|
+
- test/check_unbuild.rb
|
184
|
+
- examples/addressbook.pb.rb
|
177
185
|
- examples/writing_a_message.rb
|
178
186
|
- examples/reading_a_message.rb
|
179
|
-
- examples/addressbook.pb.rb
|