set -e # exit immediately if a simple command exits with a non-zero status
set -u # report the usage of uninitialized variables

# Available variables
# $BOSH_COMPILE_TARGET - where this package & spec'd source files are available
# $BOSH_INSTALL_TARGET - where you copy/install files to be included in package
export HOME=/var/vcap


PATH=/var/vcap/packages/git/bin:/var/vcap/packages/ruby/bin:$PATH

rsync -a cf-riak-cs-broker/* ${BOSH_INSTALL_TARGET}

pushd ${BOSH_INSTALL_TARGET}

  # Need to remove the "--no-install" directive which
  # is saved in the .bundle/config file
  rm -f .bundle/config

  # See https://www.pivotaltracker.com/n/projects/969486/stories/99155694
  # for why we specify the explicit location of the bundler binary
  /var/vcap/packages/ruby/bin/bundle install --local --deployment --without development test
popd
