#!/bin/bash

# ruby protocol buffers
# http://code.google.com/p/ruby-protobuf/
RUBY_OUT=$TARGET/ruby

# we exit with 0; treat ruby as optional at the moment
command -v "bundle" >/dev/null 2>&1 || { echo >&2 "bundle is required but not installed.  Skipping ruby protocol buffers."; exit 0; }

# creates a bin folder with 'rprotoc' command inside
bundle install --binstubs > /dev/null

# die on error at this point
set -e

echo "building ruby protocol buffers"
bin/ruby-protoc $PROTO_FILES --proto_path $SRC --ruby_out $RUBY_OUT

./package_ruby

