The truss.NamedReadWriter interface has the methods Read, Write, and
Name. *os.File fulfills this interface. A slice of them can represent a
file structure. This allows files to be directly used as NameReadWriter's.
This also allows for a truss.NamedReadWriter to be passed to functions
that accept io.Reader or io.Writer.
truss used to be composed of several protoc plugins, with lots of side
effects.
truss is now composed of one protoc plugin, protoc-gen-truss-protocout
which outputs the output of protoc.
This output, plus the .proto file with the service definition are used
to create a doctree
This doctree is then used by gendocs and gengokit to generate the
microservice and documentation.
This stucture has less side effects, and should be more testable
The addition of annotations.pb.go and http.pb.go are necessary so that
tests which make use of http annotations are able to make use of them.
They're not used in this single test, but for future tests it's
important that they be included so I'm including them now.
The slowest part of truss is exec'ing $ go build for the generated
microservice. This commit adds a build flag to truss.
If truss is called as followed:
$ truss -build=false *.proto
The generated microservice will not be built.
This was added for using truss for tests that do not involve the built
microservice.
truss has been refactored into main.go and generator/generator.go.
Where main.go deals with working directory, GOPATH, and argument
parsing and sanitation and generator.go actually exec's protoc and go
build to generate and build the microservice.
integration_tests were refactored to use `testing.T` to do logging
rather than logrus. As well as be more readable. It can also be called
with `$ go test -tags=integration -clean` in order to remove the
generated test files and nothing else.
Eventual goals are to unit test generator.go's functions and
eventually move the integration_tests to the generator package and test
by calling functions rather than execing the truss binary
This license is a copy (dates changed) of the license for another of
Tune's open source projects, `freight_forwarder`, which can be found at
https://github.com/TuneOSS/freight_forwarder