20 lines
469 B
Bash
Executable file
20 lines
469 B
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
|
|
# Make the if statement match any invocation of the "rails server" command
|
|
if [[ "${1}" == *rails ]] && ([ "${2}" == "server" ] || [ "${2}" == "s" ]); then
|
|
if [ -f tmp/pids/server.pid ]; then
|
|
rm tmp/pids/server.pid
|
|
fi
|
|
|
|
if [ ! -f /app/no_migrate ] && [ ! -v NO_MIGRATE ]; then
|
|
echo "+ preparing database..."
|
|
./bin/rails db:prepare
|
|
echo "- preparing database done."
|
|
fi
|
|
fi
|
|
|
|
# Execute the given or default command:
|
|
exec "${@}"
|
|
|