-
Notifications
You must be signed in to change notification settings - Fork 9
Generating Ruby Code From Proto Files #172
Comments
I don't. I can look into it, but I wanted to add a client library for Ruby anyways, there was just no need for it yet. Let me try creating a gem for you tomorrow that you can just add as a dependency to your project. |
It looks like this stems from running protoc alongside the outer package folder. I resolved this by moving one folder up and using Presumably, this is why the original 'working' step results in |
Thanks! From the project root, this works |
Thanks for the help, @Nzen! I started working on the gem, but didn't have the time to finish it yet. Will get back to it early next week. |
@jdno Thanks for the effort! I messed around with the generated files last night, but didn't make much progress. I assume once I have access to the gem it will be much easier because the actual gRPC calls and connection will be abstracted away. |
For the record, I used the following command to generate Go bindings (run from protoc \
--proto_path=. \
--go_out=proto \
--go-grpc_out=proto \
--go_opt=Matc/v1/airplane.proto=proto/ --go-grpc_opt=Matc/v1/airplane.proto=proto/ \
--go_opt=Matc/v1/atc.proto=proto/ --go-grpc_opt=Matc/v1/atc.proto=proto/ \
--go_opt=Matc/v1/event.proto=proto/ --go-grpc_opt=Matc/v1/event.proto=proto/ \
--go_opt=Matc/v1/game.proto=proto/ --go-grpc_opt=Matc/v1/game.proto=proto/ \
--go_opt=Matc/v1/map.proto=proto/ --go-grpc_opt=Matc/v1/map.proto=proto/ \
--go_opt=Matc/v1/tag.proto=proto/ --go-grpc_opt=Matc/v1/tag.proto=proto/ \
v1/airplane.proto atc/v1/atc.proto atc/v1/event.proto atc/v1/game.proto atc/v1/map.proto atc/v1/tag.proto
This required the following two commands installed: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest |
@jdno if you post what you have for a ruby gem, I can take a look at finishing it if you want to take a look at some of the other feature requests that have come in. |
I finally had the time to finish the gem. It's README should provide a good starting point, but feel free to extend it with any information you are missing. There is also an example. I've pushed the gem to rubygems.org under the name Please let me know if you run into any issues. If you find anything that can be improve in the gem or example, feel free to open a pull request. It's been a few years since I used Ruby in production. 😅 |
I'll admit that using proto files and gRPC is a new concept to me, so I might be doing something wrong here. But here's what I've been able to do...
protoc --proto_path=atc --ruby_out=lib atc/v1/atc.proto
outputs anlib/v1/atc_pb.rb
file successfully.However, when I run
protoc --proto_path=atc --ruby_out=lib atc/v1/atc.proto atc/v1/airplane.proto
I get...And I have confirmed that the
map.proto
andtag.proto
file is there. So that file not found error doesn't really make sense. Do you have any idea what might be going on?The text was updated successfully, but these errors were encountered: