teach protoc-gen-ruby PB_{DUMP,LOAD}_REQUEST_BYTES#307
Open
embark wants to merge 1 commit intoruby-protobuf:masterfrom
Open
teach protoc-gen-ruby PB_{DUMP,LOAD}_REQUEST_BYTES#307embark wants to merge 1 commit intoruby-protobuf:masterfrom
embark wants to merge 1 commit intoruby-protobuf:masterfrom
Conversation
| unless File.directory?(File.dirname(dump_file)) | ||
| warn "PB_DUMP_REQUEST_BYTES=#{dump_file.inspect} is not a valid path for the request bytes" | ||
| warn "Usage: PB_DUMP_REQUEST_BYTES=/path/to/desired/dump/file.bin protoc blah.proto" | ||
| exit 1 |
Contributor
Author
There was a problem hiding this comment.
cc @nerdrew did you actually want this to be exit 0?
Contributor
Author
There was a problem hiding this comment.
Nevermind this is fine, the Ruby docs on exit were misleading
`PB_DUMP_REQUEST_BYTES=foo.bin protoc foo.proto --plugin=protoc-gen-gem=bin/protoc-gen-ruby --gem_out=.` will dump the raw proto request bytes generated by protoc for foo.proto to foo.bin `PB_LOAD_REQUEST_BYTES=foo.bin bin/protoc-gen-ruby` will read the raw request bytes from foo.bin and print the generated code (actually it is the code gen response proto, but it is still readable) to STDOUT
Contributor
Author
|
Rebased this! Should be good to go. Will be useful now that we have some bins checked in for functional tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PB_DUMP_REQUEST_BYTES=foo.bin protoc foo.proto --plugin=protoc-gen-gem=bin/protoc-gen-ruby --gem_out=.will dump the raw proto request bytes generated by protoc for foo.proto to foo.bin
FUTURE USE CASE: functional tests to come that rely on checked-in bin files
PB_LOAD_REQUEST_BYTES=foo.bin bin/protoc-gen-rubywill read the raw request bytes from foo.bin and print the generated
code (actually it is the code gen response proto, but it is still
readable) to STDOUT
CURRENT USE CASE: makes it so you can use
prywhen testing code generation. If you gave the code generator input from stdin, thenprywould get the command to close at the end of the stdin input.