File routenbuch-update.sh of Package routenbuch

#!/bin/bash
set -e

export RAILS_ENV="${RAILS_ENV:=production}"
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"

BUNDLER="@BUNDLER_REPLACE@"
USER="routenbuch"
SUDO="sudo -u $USER --preserve-env=RAILS_ENV,LC_ALL,LANG"

echo "Switching to the basedir within env $RAILS_ENV"
pushd /srv/www/webapps/routenbuch/ >/dev/null

if [ ! -e tmp/rebuild.txt ] ; then
  echo "Nothing to do for routenbuch-update. Exiting"
  exit 0
fi

echo "Running rake"
$SUDO $BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ db:migrate
$SUDO $BUNDLER exec /usr/bin/rake.@RUBY_SUFFIX@ tmp:clear

echo "Running bootsnap"
$SUDO $BUNDLER exec bootsnap precompile --gemfile app/ lib/

echo "Fixing permissions"
chown -R routenbuch:routenbuch log/ tmp/

echo "Trigger tmp/restart.txt"
$SUDO touch tmp/restart.txt

echo "Finalize rebuild"
rm -f tmp/rebuild.txt

popd >/dev/null
openSUSE Build Service is sponsored by