d17326ecd9
That the ruby version is mostly shelling out is a hint that a shell language
might be a better choice. It's more direct, slightly faster, it sidesteps
chicken/egg problems when installing ruby, and writing things in bash is fun.
It's good to have an excuse to flex those shell muscles 💪
35 lines
691 B
Bash
Executable File
35 lines
691 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
app_root="$( cd "$(dirname "$0")/.."; pwd )"
|
|
app_name="splat"
|
|
|
|
# Use application binstubs
|
|
export PATH="$app_root/bin:$PATH"
|
|
|
|
announce() {
|
|
echo
|
|
echo "--- $@"
|
|
}
|
|
|
|
announce "Installing dependencies"
|
|
gem install bundler --conservative
|
|
bundle check || bundle install
|
|
|
|
announce "Preparing database"
|
|
rails db:prepare
|
|
|
|
announce "Removing old logs and tempfiles"
|
|
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 https://$app_name.test/up: "
|
|
curl -Is "https://$app_name.test/up" | head -n 1
|
|
fi
|