protobuf_descriptor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.travis.yml +6 -0
  4. data/.yardopts +1 -1
  5. data/ChangeLog.rdoc +12 -0
  6. data/README.md +61 -0
  7. data/Rakefile +114 -0
  8. data/lib/protobuf_descriptor/enum_descriptor.rb +17 -11
  9. data/lib/protobuf_descriptor/enum_value_descriptor.rb +29 -0
  10. data/lib/protobuf_descriptor/field_descriptor.rb +80 -0
  11. data/lib/protobuf_descriptor/file_descriptor.rb +37 -17
  12. data/lib/protobuf_descriptor/has_children.rb +49 -0
  13. data/lib/protobuf_descriptor/has_parent.rb +42 -0
  14. data/lib/protobuf_descriptor/message_descriptor.rb +20 -104
  15. data/lib/protobuf_descriptor/method_descriptor.rb +54 -0
  16. data/lib/protobuf_descriptor/named_child.rb +7 -0
  17. data/lib/protobuf_descriptor/service_descriptor.rb +9 -61
  18. data/lib/protobuf_descriptor/version.rb +1 -1
  19. data/lib/protobuf_descriptor.rb +20 -5
  20. data/protobuf_descriptor.gemspec +3 -2
  21. data/spec/field_descriptor_spec.rb +1 -1
  22. data/spec/file_descriptor_spec.rb +0 -1
  23. data/spec/method_descriptor_spec.rb +1 -1
  24. data/spec/protobuf_descriptor_spec.rb +3 -3
  25. data/spec/protoc_generator_spec.rb +6 -9
  26. data/spec/protos/custom_options/custom_options.proto +53 -0
  27. data/spec/protos/custom_options/google/protobuf/descriptor.proto +620 -0
  28. data/spec/protos/custom_options.desc +0 -0
  29. data/spec/protos/custom_options.java.zip +0 -0
  30. data/spec/protos/custom_options.wire.zip +0 -0
  31. data/spec/protos/generator_test.desc +24 -0
  32. data/spec/protos/generator_test.java.zip +0 -0
  33. data/spec/protos/generator_test.wire.zip +0 -0
  34. data/spec/protos/service_rpc_test.desc +71 -0
  35. data/spec/protos/service_rpc_test.java.zip +0 -0
  36. data/spec/protos/service_rpc_test.wire.zip +0 -0
  37. data/spec/protos/single_file_test.desc +0 -0
  38. data/spec/protos/single_file_test.java.zip +0 -0
  39. data/spec/protos/single_file_test.wire.zip +0 -0
  40. data/spec/protos/source_info/foo.proto +59 -0
  41. data/spec/protos/source_info.desc +22 -0
  42. data/spec/protos/source_info.java.zip +0 -0
  43. data/spec/protos/source_info.srcinfo.desc +0 -0
  44. data/spec/protos/source_info.wire.zip +0 -0
  45. data/spec/service_descriptor_spec.rb +1 -1
  46. data/spec/source_code_info_spec.rb +57 -0
  47. data/spec/spec_helper.rb +29 -57
  48. data/spec/wire_generator_spec.rb +6 -11
  49. metadata +69 -11
  50. data/Gemfile.lock +0 -58
  51. data/README.rdoc +0 -51
@@ -0,0 +1,71 @@
1
+
2
+ �
3
+ #wearabouts_api/multiple_files.protoWearaboutsApi.MultipleFiles"
4
+ Icon
5
+
6
+ id (*
7
+ IconEnum
8
+ FOOB$
9
+ us.wearabouts.chatabout.multipleP
10
+ �
11
+ &wearabouts_api/outer_class_proto.protoWearaboutsApi.OuterClassProto"
12
+ Icon
13
+
14
+ id (*
15
+ IconEnum
16
+ FOOB/
17
+ us.wearabouts.chatabout.outerBOuterClassName
18
+ �
19
+ wearabouts_api/user.protoWearaboutsApi.Userwearabouts_pb.proto"T
20
+ AuthenticateRequest
21
+ email ( 
22
+ phone ( 
23
+ device_id ( 
24
+ name ( "�
25
+ AuthenticateResponse%
26
+ user ( 2.WearaboutsPb.UserProto2
27
+ device_link ( 2.WearaboutsPb.DeviceLinkProto
28
+
29
+ auth_token ( "
30
+ MeRequest"g
31
+
32
+ MeResponse%
33
+ user ( 2.WearaboutsPb.UserProto2
34
+ device_link ( 2.WearaboutsPb.DeviceLinkProto"!
35
+ UpdateNameRequest
36
+ name ( ";
37
+ UpdateNameResponse%
38
+ user ( 2.WearaboutsPb.UserProto2�
39
+ UserServicea
40
+ Authenticate'.WearaboutsApi.User.AuthenticateRequest(.WearaboutsApi.User.AuthenticateResponseC
41
+ Me.WearaboutsApi.User.MeRequest.WearaboutsApi.User.MeResponse[
42
+
43
+ UpdateName%.WearaboutsApi.User.UpdateNameRequest&.WearaboutsApi.User.UpdateNameResponseB$
44
+ "us.wearabouts.chatabout.proto.user
45
+ �
46
+ wearabouts_pb.proto WearaboutsPb"�
47
+ UserProto
48
+
49
+ id ( 9
50
+ user_details ( 2#.WearaboutsPb.UserProto.UserDetails9
51
+ UserDetails
52
+ email ( 
53
+ phone ( 
54
+ name ( "N
55
+ ConversationProto
56
+
57
+ id ( -
58
+ participants ( 2.WearaboutsPb.UserProto"�
59
+ PostProto
60
+
61
+ id ( *
62
+ kind (2.WearaboutsPb.PostProto.Kind
63
+ textd ( 
64
+ audio_url� ( "
65
+ Kind
66
+ TEXT
67
+ AUDIO"6
68
+ DeviceLinkProto
69
+ device_id ( 
70
+ verified (B
71
+ us.wearabouts.chatabout.proto
Binary file
@@ -0,0 +1,59 @@
1
+ package foo;
2
+
3
+ // Test message for Bar
4
+ message Bar {
5
+ // Test message for NestedEnum
6
+ enum NestedEnum {
7
+ // Test message for VALUE_TWO
8
+ VALUE_TWO = 1;
9
+ }
10
+
11
+ // Test message for NestedBar
12
+ message NestedBar {
13
+ // Test message for NestedNestedEnum
14
+ enum NestedNestedEnum {
15
+ // Test message for VALUE_THREE
16
+ VALUE_THREE = 1;
17
+ }
18
+ // Test message for foo
19
+ required NestedNestedEnum foo = 1;
20
+ }
21
+
22
+ optional int32 foo = 1; // Comment attached to foo.
23
+ // Comment attached to bar.
24
+ optional int32 bar = 2;
25
+
26
+ optional string baz = 3;
27
+ // Comment attached to baz.
28
+ // Another line attached to baz.
29
+
30
+ // Comment attached to qux.
31
+ //
32
+ // Another line attached to qux.
33
+ optional double qux = 4;
34
+
35
+ optional string corge = 5;
36
+ /* Block comment attached
37
+ * to corge. Leading asterisks
38
+ * will be removed. */
39
+ /* Block comment attached to
40
+ * grault. */
41
+ optional int32 grault = 6;
42
+ }
43
+ // Comment attached to Bar
44
+
45
+ // Comment for FooService
46
+ service FooService {
47
+ /* Comment for Baz
48
+ * Maybe comments on return types.
49
+ */
50
+ rpc Baz(Bar) returns (Bar);
51
+ // Trailing comment for Baz
52
+ }
53
+ // Comment attached to FooService
54
+
55
+ // Comment for BaseEnum
56
+ enum BaseEnum {
57
+ // Comment for VALUE_ONE
58
+ VALUE_ONE = 1;
59
+ }
@@ -0,0 +1,22 @@
1
+
2
+ �
3
+ foo.protofoo"�
4
+ Bar
5
+ foo (
6
+ bar (
7
+ baz ( 
8
+ qux (
9
+ corge ( 
10
+ grault (b
11
+ NestedBar0
12
+ foo (2#.foo.Bar.NestedBar.NestedNestedEnum"#
13
+ NestedNestedEnum
14
+ VALUE_THREE"
15
+
16
+ NestedEnum
17
+ VALUE_TWO*
18
+ BaseEnum
19
+ VALUE_ONE2'
20
+
21
+ FooService
22
+ Baz.foo.Bar.foo.Bar
Binary file
Binary file
@@ -6,7 +6,7 @@ describe ProtobufDescriptor::ServiceDescriptor do
6
6
  with_descriptor("service_rpc_test") do |descriptor|
7
7
  service_descriptor = descriptor["wearabouts_api/user"].services[:UserService]
8
8
  expect(service_descriptor).to be_a(ProtobufDescriptor::ServiceDescriptor)
9
- expect(service_descriptor.methods).to have(3).items
9
+ expect(service_descriptor.methods.size).to eq(3)
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,57 @@
1
+ require "spec_helper"
2
+
3
+ describe "source_code_info" do
4
+ let(:descriptor) { load_descriptor("source_info.srcinfo") }
5
+ let(:no_info_descriptor) { load_descriptor("source_info") }
6
+
7
+ describe "with no source info" do
8
+ it "ProtobufDescriptor#has_source_code_info? returns false" do
9
+ expect(no_info_descriptor.has_source_code_info?).to eq(false)
10
+ end
11
+
12
+ it "ProtobufDescriptor::FileDescriptor#has_source_code_info? returns false" do
13
+ expect(no_info_descriptor.files.first.has_source_code_info?).to eq(false)
14
+ end
15
+ end
16
+
17
+ it "ProtobufDescriptor#has_source_code_info? returns true" do
18
+ expect(descriptor.has_source_code_info?).to eq(true)
19
+ end
20
+
21
+ it "ProtobufDescriptor::FileDescriptor#has_source_code_info? returns true" do
22
+ expect(descriptor.files.first.has_source_code_info?).to eq(true)
23
+ end
24
+
25
+ it "ProtobufDescriptor::FileDescriptor#compute_source_code_info_path" do
26
+ file = descriptor["foo"]
27
+
28
+ expect(file.message_types.first.compute_source_code_info_path).to eq([4, 0])
29
+ expect(descriptor.resolve_type_name(".foo.Bar").compute_source_code_info_path).to eq([4, 0])
30
+ expect(file.enum_types.first.compute_source_code_info_path).to eq([5, 0])
31
+ expect(file.services.first.compute_source_code_info_path).to eq([6, 0])
32
+ end
33
+
34
+ it "ProtobufDescriptor::FieldDescriptor#compute_source_code_info_path" do
35
+ file = descriptor["foo"]
36
+
37
+ expect(descriptor.resolve_type_name(".foo.Bar").fields[0].compute_source_code_info_path).to eq([4, 0, 2, 0])
38
+ expect(descriptor.resolve_type_name(".foo.Bar.NestedBar").compute_source_code_info_path).to eq([4, 0, 3, 0])
39
+ expect(descriptor.resolve_type_name(".foo.Bar.NestedEnum").compute_source_code_info_path).to eq([4, 0, 4, 0])
40
+ end
41
+
42
+ it "ProtobufDescriptor::HasParent#leading_comments" do
43
+ expect(descriptor.resolve_type_name(".foo.Bar").leading_comments.strip).to eq("Test message for Bar")
44
+ expect(descriptor.resolve_type_name(".foo.Bar").fields["bar"].leading_comments.strip).to eq("Comment attached to bar.")
45
+ expect(descriptor.resolve_type_name(".foo.Bar").fields["grault"].leading_comments.strip).to eq("Block comment attached to\n grault.")
46
+ expect(descriptor.resolve_type_name(".foo.FooService").leading_comments.strip).to eq("Comment for FooService")
47
+ expect(descriptor.resolve_type_name(".foo.FooService").methods["Baz"].leading_comments.strip).to eq("Comment for Baz\n Maybe comments on return types.")
48
+ expect(descriptor.resolve_type_name(".foo.BaseEnum").leading_comments.strip).to eq("Comment for BaseEnum")
49
+ expect(descriptor.resolve_type_name(".foo.BaseEnum").values["VALUE_ONE"].leading_comments).to eq(" Comment for VALUE_ONE\n")
50
+ expect(descriptor.resolve_type_name(".foo.Bar.NestedEnum").values["VALUE_TWO"].leading_comments).to eq(" Test message for VALUE_TWO\n")
51
+ expect(descriptor.resolve_type_name(".foo.Bar.NestedBar.NestedNestedEnum").values["VALUE_THREE"].leading_comments).to eq(" Test message for VALUE_THREE\n")
52
+ end
53
+
54
+ it "ProtobufDescriptor::HasParent#trailing_comments" do
55
+ expect(descriptor.resolve_type_name(".foo.Bar").fields["foo"].trailing_comments).to eq(" Comment attached to foo.\n")
56
+ end
57
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,33 @@
1
- require 'rspec'
1
+ require "rspec"
2
2
  require "protobuf_descriptor"
3
3
 
4
4
  require "fileutils"
5
5
  require "pathname"
6
6
  require "tempfile"
7
+ require "tmpdir"
8
+ require "zip"
9
+
10
+ VERBOSE = false
7
11
 
8
12
  # "Parses" a java package returning a mapping of class/enum names to their fully
9
13
  # qualified name.
10
14
  #
11
15
  # Raises if a class name occurs twice.
12
16
  def ghetto_parse_java_package(dir)
17
+ if dir.end_with?(".zip")
18
+ Dir.mktmpdir do |temp_dir|
19
+ Zip::File.open(dir) do |zip_file|
20
+ zip_file.each do |entry|
21
+ puts "Making #{temp_dir}/#{File.dirname(entry.name)}" if VERBOSE
22
+ FileUtils.mkdir_p File.join(temp_dir, File.dirname(entry.name))
23
+ puts "Extracting #{temp_dir}/#{entry.name}" if VERBOSE
24
+ entry.extract(File.join(temp_dir, entry.name))
25
+ end
26
+ end
27
+ return ghetto_parse_java_package(temp_dir)
28
+ end
29
+ end
30
+
13
31
  tokens = [
14
32
  # Wire enum
15
33
  [:enum, /public\s+enum\s+(\w+)\s+implements\s+ProtoEnum\s+{/],
@@ -34,7 +52,7 @@ def ghetto_parse_java_package(dir)
34
52
  package = contents.match(/package\s+([\w\.]+);/)
35
53
  package = package[1] unless package.nil?
36
54
 
37
- # puts "#{filename[dir.length..-1]}: package #{package}"
55
+ puts "#{filename[dir.length..-1]}: package #{package}" if VERBOSE
38
56
 
39
57
  bits = [package]
40
58
 
@@ -64,7 +82,7 @@ def ghetto_parse_java_package(dir)
64
82
  bits.pop
65
83
  end
66
84
 
67
- # puts "#{token}@#{offset} #{bits.inspect}"
85
+ puts "#{token}@#{offset} #{bits.inspect}" if VERBOSE
68
86
  end
69
87
  end
70
88
  return found
@@ -80,62 +98,12 @@ def with_temp_file(name="tempfile")
80
98
  end
81
99
  end
82
100
 
83
- def compile_wire_protobuf(args={})
84
- args = {
85
- destination: ".",
86
- source: ".",
87
- extra_args: []
88
- }.merge(args)
89
-
90
- jar_path = File.realpath("#{File.dirname(__FILE__)}/../wire-compiler.jar")
91
- command = ["java", "-jar", jar_path]
92
- command << "--proto_path=#{args[:source]}"
93
- command += args[:extra_args]
94
- command << "--java_out=#{args[:destination]}"
95
- command += Dir.glob("#{args[:source]}**/*.proto").map { |p|
96
- Pathname.new(p).relative_path_from(Pathname.new(args[:source])).to_s
97
- }
98
- with_temp_file do |tmp_log|
99
- rv = system(*command, out: [tmp_log.path, "a"], err: [tmp_log.path, "a"])
100
-
101
- raise "Wire protobuf generation failed!\n#{File.read(tmp_log)}" unless rv
102
- end
103
- end
104
-
105
- def generate_protobuf_descriptor(args={})
106
- args = {
107
- source: ".",
108
- extra_args: [],
109
- plugin: nil,
110
- plugin_out: "",
111
- out: "out.desc"
112
- }.merge(args)
113
- args[:source] += '/' unless args[:source].end_with?('/')
114
-
115
- command = []
116
- command << "protoc"
117
- command << "-I#{args[:source]}"
118
- if args[:plugin]
119
- command << "--#{args[:plugin]}_out=#{args[:plugin_out]}"
120
- end
121
- command += args[:extra_args]
122
- command << "--descriptor_set_out=#{args[:out]}"
123
- command += Dir.glob("#{args[:source]}**/*.proto")
124
-
125
- rv = system(*command)
126
-
127
- raise "ProtobufDescriptor generation failed!" unless rv
101
+ def with_descriptor_file(source, args={})
102
+ yield File.open("#{File.dirname(__FILE__)}/protos/#{source}.desc")
128
103
  end
129
104
 
130
- def with_descriptor_file(source, args={})
131
- with_temp_file do |f|
132
- args = {
133
- out: f.path,
134
- source: "#{File.dirname(__FILE__)}/protos/#{source}/"
135
- }.merge(args)
136
- generate_protobuf_descriptor(args)
137
- yield f
138
- end
105
+ def find_generated_files(source, kind)
106
+ return "#{File.dirname(__FILE__)}/protos/#{source}.#{kind}.zip"
139
107
  end
140
108
 
141
109
  def with_descriptor(source, args={})
@@ -143,3 +111,7 @@ def with_descriptor(source, args={})
143
111
  yield ProtobufDescriptor.decode_from(f)
144
112
  end
145
113
  end
114
+
115
+ def load_descriptor(source)
116
+ ProtobufDescriptor.load(File.join(File.dirname(__FILE__), "protos", "#{source}.desc"))
117
+ end
@@ -5,19 +5,14 @@ describe "WireCompiler" do
5
5
  # Compile the contents of the generator_tests proto dir, and then assert
6
6
  # everything is where it should be.
7
7
  it "computes fully-qualified class names correctly" do
8
- Dir.mktmpdir do |dir|
9
- # The following is to compile protos with wire, since its done as a
10
- # separate process:
11
- compile_wire_protobuf(source: "#{File.dirname(__FILE__)}/protos/generator_test/", destination: dir)
12
- generated_classes = ghetto_parse_java_package(dir)
8
+ with_descriptor("generator_test") do |descriptor|
9
+ generated_classes = ghetto_parse_java_package(find_generated_files("generator_test", :wire))
13
10
 
14
- with_descriptor("generator_test") do |descriptor|
15
- children = descriptor.all_descendants
11
+ children = descriptor.all_descendants.map { |child|
12
+ [child.name, child.fully_qualified_wire_name]
13
+ }
16
14
 
17
- children.each do |child|
18
- expect(child.fully_qualified_wire_name).to eq(generated_classes[child.name])
19
- end
20
- end
15
+ expect(children).to contain_exactly(*generated_classes.to_a)
21
16
  end
22
17
  end
23
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf_descriptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hsiu-Fan Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-26 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf
@@ -25,19 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 1.1.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: 1.1.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.3'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '2.4'
75
+ version: 3.0.0.beta2
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '2.4'
82
+ version: 3.0.0.beta2
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubygems-tasks
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -104,18 +118,22 @@ files:
104
118
  - ".document"
105
119
  - ".gitignore"
106
120
  - ".rspec"
121
+ - ".travis.yml"
107
122
  - ".yardopts"
108
123
  - ChangeLog.rdoc
109
124
  - Gemfile
110
- - Gemfile.lock
111
125
  - LICENSE.txt
112
- - README.rdoc
126
+ - README.md
113
127
  - Rakefile
114
128
  - lib/protobuf_descriptor.rb
115
129
  - lib/protobuf_descriptor/enum_descriptor.rb
130
+ - lib/protobuf_descriptor/enum_value_descriptor.rb
131
+ - lib/protobuf_descriptor/field_descriptor.rb
116
132
  - lib/protobuf_descriptor/file_descriptor.rb
133
+ - lib/protobuf_descriptor/has_children.rb
117
134
  - lib/protobuf_descriptor/has_parent.rb
118
135
  - lib/protobuf_descriptor/message_descriptor.rb
136
+ - lib/protobuf_descriptor/method_descriptor.rb
119
137
  - lib/protobuf_descriptor/named_child.rb
120
138
  - lib/protobuf_descriptor/named_collection.rb
121
139
  - lib/protobuf_descriptor/service_descriptor.rb
@@ -128,16 +146,36 @@ files:
128
146
  - spec/method_descriptor_spec.rb
129
147
  - spec/protobuf_descriptor_spec.rb
130
148
  - spec/protoc_generator_spec.rb
149
+ - spec/protos/custom_options.desc
150
+ - spec/protos/custom_options.java.zip
151
+ - spec/protos/custom_options.wire.zip
152
+ - spec/protos/custom_options/custom_options.proto
153
+ - spec/protos/custom_options/google/protobuf/descriptor.proto
154
+ - spec/protos/generator_test.desc
155
+ - spec/protos/generator_test.java.zip
156
+ - spec/protos/generator_test.wire.zip
131
157
  - spec/protos/generator_test/aaa.proto
132
158
  - spec/protos/generator_test/foo/aab.proto
133
159
  - spec/protos/generator_test/java_package.proto
134
160
  - spec/protos/generator_test/outer_class_name.proto
161
+ - spec/protos/service_rpc_test.desc
162
+ - spec/protos/service_rpc_test.java.zip
163
+ - spec/protos/service_rpc_test.wire.zip
135
164
  - spec/protos/service_rpc_test/wearabouts_api/multiple_files.proto
136
165
  - spec/protos/service_rpc_test/wearabouts_api/outer_class_proto.proto
137
166
  - spec/protos/service_rpc_test/wearabouts_api/user.proto
138
167
  - spec/protos/service_rpc_test/wearabouts_pb.proto
168
+ - spec/protos/single_file_test.desc
169
+ - spec/protos/single_file_test.java.zip
170
+ - spec/protos/single_file_test.wire.zip
139
171
  - spec/protos/single_file_test/single_file.proto
172
+ - spec/protos/source_info.desc
173
+ - spec/protos/source_info.java.zip
174
+ - spec/protos/source_info.srcinfo.desc
175
+ - spec/protos/source_info.wire.zip
176
+ - spec/protos/source_info/foo.proto
140
177
  - spec/service_descriptor_spec.rb
178
+ - spec/source_code_info_spec.rb
141
179
  - spec/spec_helper.rb
142
180
  - spec/wire_generator_spec.rb
143
181
  homepage: https://github.com/hfwang/protobuf_descriptor
@@ -172,15 +210,35 @@ test_files:
172
210
  - spec/method_descriptor_spec.rb
173
211
  - spec/protobuf_descriptor_spec.rb
174
212
  - spec/protoc_generator_spec.rb
213
+ - spec/protos/custom_options.desc
214
+ - spec/protos/custom_options.java.zip
215
+ - spec/protos/custom_options.wire.zip
216
+ - spec/protos/custom_options/custom_options.proto
217
+ - spec/protos/custom_options/google/protobuf/descriptor.proto
218
+ - spec/protos/generator_test.desc
219
+ - spec/protos/generator_test.java.zip
220
+ - spec/protos/generator_test.wire.zip
175
221
  - spec/protos/generator_test/aaa.proto
176
222
  - spec/protos/generator_test/foo/aab.proto
177
223
  - spec/protos/generator_test/java_package.proto
178
224
  - spec/protos/generator_test/outer_class_name.proto
225
+ - spec/protos/service_rpc_test.desc
226
+ - spec/protos/service_rpc_test.java.zip
227
+ - spec/protos/service_rpc_test.wire.zip
179
228
  - spec/protos/service_rpc_test/wearabouts_api/multiple_files.proto
180
229
  - spec/protos/service_rpc_test/wearabouts_api/outer_class_proto.proto
181
230
  - spec/protos/service_rpc_test/wearabouts_api/user.proto
182
231
  - spec/protos/service_rpc_test/wearabouts_pb.proto
232
+ - spec/protos/single_file_test.desc
233
+ - spec/protos/single_file_test.java.zip
234
+ - spec/protos/single_file_test.wire.zip
183
235
  - spec/protos/single_file_test/single_file.proto
236
+ - spec/protos/source_info.desc
237
+ - spec/protos/source_info.java.zip
238
+ - spec/protos/source_info.srcinfo.desc
239
+ - spec/protos/source_info.wire.zip
240
+ - spec/protos/source_info/foo.proto
184
241
  - spec/service_descriptor_spec.rb
242
+ - spec/source_code_info_spec.rb
185
243
  - spec/spec_helper.rb
186
244
  - spec/wire_generator_spec.rb
data/Gemfile.lock DELETED
@@ -1,58 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- protobuf_descriptor (0.1.0)
5
- activesupport (>= 3.0.0)
6
- protobuf (~> 3.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activesupport (4.1.0)
12
- i18n (~> 0.6, >= 0.6.9)
13
- json (~> 1.7, >= 1.7.7)
14
- minitest (~> 5.1)
15
- thread_safe (~> 0.1)
16
- tzinfo (~> 1.1)
17
- coderay (1.1.0)
18
- diff-lcs (1.2.5)
19
- i18n (0.6.9)
20
- json (1.8.1)
21
- method_source (0.8.2)
22
- middleware (0.1.0)
23
- minitest (5.3.3)
24
- multi_json (1.9.2)
25
- protobuf (3.0.4)
26
- activesupport (>= 3.2)
27
- middleware
28
- multi_json
29
- thor
30
- pry (0.9.12.6)
31
- coderay (~> 1.0)
32
- method_source (~> 0.8)
33
- slop (~> 3.4)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.8)
39
- rspec-expectations (2.14.5)
40
- diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.6)
42
- rubygems-tasks (0.2.4)
43
- slop (3.5.0)
44
- thor (0.19.1)
45
- thread_safe (0.3.3)
46
- tzinfo (1.1.0)
47
- thread_safe (~> 0.1)
48
- yard (0.8.7.4)
49
-
50
- PLATFORMS
51
- ruby
52
-
53
- DEPENDENCIES
54
- protobuf_descriptor!
55
- pry (~> 0.9.12.6)
56
- rspec (~> 2.4)
57
- rubygems-tasks (~> 0.2)
58
- yard (~> 0.8)
data/README.rdoc DELETED
@@ -1,51 +0,0 @@
1
- = protobuf_descriptor
2
-
3
- * {Homepage}[https://rubygems.org/gems/protobuf_descriptor]
4
- * {Documentation}[http://rubydoc.info/github/hfwang/protobuf_descriptor/master/frames]
5
-
6
- == Description
7
-
8
- Protobuf_descriptor provides helper methods to make working with Google Protocol
9
- Buffer descriptors easier, go figure.. It handles type resolution, and computing
10
- type names (both within protocol buffers and in the generated output).
11
-
12
- == Examples
13
-
14
- Given the +descriptor.desc+ generated by the protocol buffer compiler, you
15
- can introspect the various data types. This example references the descriptor
16
- that would be generated by compiling
17
- {single_file.proto}[https://github.com/hfwang/protobuf_descriptor/blob/master/spec/protos/single_file_test/single_file.proto]
18
-
19
- require 'protobuf_descriptor'
20
- descriptor = ProtobufDescriptor.load("descriptor.desc")
21
-
22
- # Load a single file by its filename/basename
23
- file_descriptor = descriptor[:single_file]
24
-
25
- # Grab a handle to an enum, or a message
26
- file_descriptor.messages[:FieldOptions]
27
- file_descriptor.enums[:UnnestedEnum]
28
-
29
- # Also allows resolving types by their fully qualified name:
30
- descriptor.resolve_type(".porkbuns.UnnestedEnum") # note the leading "."
31
- # or even doing so relative to another enum
32
- descriptor.resolve_type("CType", ".porkbuns.FieldOptions")
33
-
34
- For even more gory details, please peruse the actual
35
- {documentation}[http://rubydoc.info/github/hfwang/protobuf_descriptor/master/frames].
36
-
37
- == Requirements
38
-
39
- I've only tested this on Ruby 1.9.3+. If it works for you on an older version of
40
- Ruby, let me know. You most likely want to install the
41
- {Google Protocol Buffer library}[https://code.google.com/p/protobuf/].
42
-
43
- == Install
44
-
45
- $ gem install protobuf_descriptor
46
-
47
- == Copyright
48
-
49
- Copyright (c) 2014 Hsiu-Fan Wang
50
-
51
- See LICENSE.txt for details.