Files
adamantium/script/bootstrap
2023-01-27 22:55:09 +11:00

39 lines
907 B
Bash
Executable File

#!/bin/sh
# script/bootstrap: Resolve all dependencies that the application requires to
# run.
set -e
cd "$(dirname "$0")/.."
if [ "$1" = "docker" ]; then
docker-compose run --rm app "bundle"
docker-compose run --rm --entrypoint "/bin/sh -lc" assets "npm install"
else
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi
if [ -f ".tool-versions" ] && [ "$(uname -s)" = "Darwin" ]; then
echo "==> Installing package versions…"
brew bootstrap-asdf
fi
if [ -f "Gemfile" ]; then
echo "==> Installing gem dependencies…"
bundle check >/dev/null 2>&1 || {
bundle config set without 'production'
bundle install --quiet
}
fi
if [ -f "package.json" ]; then
echo "==> Installing node packages…"
npm install
fi
fi