Last active
October 10, 2022 03:30
-
-
Save mitchbne/ed4da0fb09a809dbadda2d6bd3430be1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e; | |
PAYAUS_DIR=$(git rev-parse --show-toplevel) | |
PAYAUS_RUBY_VERSION=$(cat $PAYAUS_DIR/.ruby-version); | |
PAYAUS_NODE_VERSION=$(cat $PAYAUS_DIR/.nvmrc); | |
run-setup-macbook-pro() { | |
echo "Please run the 'setup_macbook_pro.sh' script first". | |
exit 1; | |
} | |
# Ensure that the setup_macbook_pro.sh script has been run | |
if ! command -v brew >/dev/null 2>&1; then | |
run-setup-macbook-pro; | |
fi | |
if ! command -v node >/dev/null 2>&1; then | |
run-setup-macbook-pro | |
fi | |
if ! command -v yarn >/dev/null 2>&1; then | |
run-setup-macbook-pro | |
fi | |
if ! command -v rbenv >/dev/null 2>&1; then | |
run-setup-macbook-pro | |
fi | |
# Install system dependencies to payaus | |
if ! brew list postgresql >/dev/null 2>&1; then | |
echo "Installing postgresql" | |
brew install postgresql@14 | |
fi | |
if ! brew list jq >/dev/null 2>&1; then | |
echo "Installing jq" | |
brew install jq | |
fi | |
# Install correct version of Ruby for payaus | |
# Only install if the version is different than the current version | |
if ! rbenv versions | grep -q $PAYAUS_RUBY_VERSION; then | |
echo "Installing Ruby $PAYAUS_RUBY_VERSION" | |
rbenv install $PAYAUS_RUBY_VERSION | |
fi | |
# Install correct version of Node for payaus | |
source $HOME/.nvm/nvm.sh | |
if ! nvm list | grep -q $PAYAUS_NODE_VERSION; then | |
echo "Installing Node $PAYAUS_NODE_VERSION" | |
nvm install $PAYAUS_NODE_VERSION | |
nvm use --default $PAYAUS_NODE_VERSION; | |
fi | |
bundle check || bundle install; | |
yarn install; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment