payshares-xdrgen
is a code generator that takes XDR IDL files (.x
files) as specfified
in RFC 4506 and spits code out in
various languages.
Xdrgen is a very early project. Aside from the test fixtures in spec/fixtures, the only .x files that have been thrown at it are the .x files used for the payshares-core project.
Xdrgen presently supports three output languages: ruby, javacript, and golang:
- ruby: complete support
- javascript: complete but only lightly exercised
- golang: buggy and experimental
Testing is very sparse, but will improve over time.
Xdrgen is a rubygem, compatible with ruby 2.1 or higher
$ gem install payshares-xdrgen
The command line:
xdrgen [-o OUTPUT_DIR] [-l LANGUAGE] [-n NAMESPACE] [INPUT_FILES ...]
Add this line to your application's Gemfile:
gem 'payshares-xdrgen'
And then execute:
$ bundle
Example usage:
require 'payshares-xdrgen'
# create a compilation object, specifying your options
c = Xdrgen::Compilation.new(
["MyProgram.x"],
output_dir:"src/generated",
language: :ruby
namespace: "MyProgram::XDR"
)
# then run compile
c.compile
- Fork it ( https://github.com/payshares/payshares-xdrgen/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request