mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-03-13 13:45:16 +09:00
46 lines
871 B
Bash
Executable File
46 lines
871 B
Bash
Executable File
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
app_root="$( cd "$(dirname "$0")/.."; pwd )"
|
|
app_name=campfire
|
|
|
|
# Use application binstubs
|
|
export PATH="$app_root/bin:$PATH"
|
|
|
|
announce() {
|
|
echo
|
|
echo "--- $@"
|
|
}
|
|
|
|
if [ "$RAILS_ENV" == "production" ]
|
|
then
|
|
echo "RAILS_ENV is production; bailing out"
|
|
exit
|
|
fi
|
|
|
|
announce "Installing dependencies"
|
|
mise install
|
|
bundle install
|
|
|
|
announce "Preparing database"
|
|
if [[ $* == *--reset* ]]; then
|
|
rm -rf ./storage/{db,files}
|
|
rails db:migrate:reset
|
|
else
|
|
rails db:prepare
|
|
fi
|
|
|
|
announce "Cleaning up old logs, caches, and temporary files"
|
|
rails log:clear tmp:clear
|
|
|
|
announce "Restarting services"
|
|
rails restart
|
|
|
|
if [ -d "$HOME/.puma-dev" ]; then
|
|
announce "Configuring puma-dev"
|
|
ln -nfs "$app_root" "$HOME/.puma-dev/$app_name"
|
|
|
|
announce "Checking that https://$app_name.test/up is live: "
|
|
curl -Is "https://$app_name.test/up" | head -n 1
|
|
fi
|