Tired of manually regenerating your Thrift interface code every time the definition changes? Thrifty manages your Thrift interface definitions behind the scenes.
require 'thrifty'
Thrifty.register('my_interface.thrift')
Thrifty.require('generated_service')
GeneratedService.do_things
See the examples directory for a complete working example.
When using Thrifty in production, you'll likely want to precompile your Thrift IDLs. The way I'd recommend doing this is as follows:
In lib/myapp/thrift.rb
:
require 'thrifty'
Thrifty.register('my_interface.thrift', relative_to: __FILE__, build_root: 'build')
Your build step will then just be:
require 'myapp/thrift'
Thrifty.compile_all
You must have a working thrift compiler on your PATH. (That is, you should be able to just type 'thrift'.) Thrifty does not currently statically check that this is the case.
- Statically ensure there's a thrift compiler on the PATH.
- Autorequire of all generated Thrift files?