#!/bin/bash -l

# Source test specific env variables only in tests
HTH_TEST_ENV_FILE_PATH=$HTH_BACKEND_PATH/.env.test

if [ ! -z "$HTH_TEST_ENV" ] ; then
  source $HTH_TEST_ENV_FILE_PATH
fi

# Source the temp env file
ENV_FILE_PATH=$PWD/hth.env.tmp

if [ -e $ENV_FILE_PATH ] ; then
  source $ENV_FILE_PATH
fi

# Silence warning for production
if [ "$RACK_ENV" = "production" ]; then
  export RUBYOPT="-W0"
fi

BUNDLE_GEMFILE=$HTH_BACKEND_PATH/Gemfile bundle exec $HTH_BACKEND_PATH/bin/hooks/git/update.rb $*

exit $?
