Skip to content

Instantly share code, notes, and snippets.

@BronsonQuick
Last active March 22, 2018 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BronsonQuick/4c7fd31b851da4fc28ea296f0eb95868 to your computer and use it in GitHub Desktop.
Save BronsonQuick/4c7fd31b851da4fc28ea296f0eb95868 to your computer and use it in GitHub Desktop.
A script to setup wpaustralia.org
#!/usr/bin/env sh
set -e
HAS_GIT=`command -v git 2&>/dev/null || echo "false"`
HAS_BREW=`command -v brew 2&>/dev/null || echo "false"`
HAS_VAGRANT=`command -v vagrant 2&>/dev/null || echo "false"`
HAS_VIRTUALBOX=`command -v VirtualBox 2&>/dev/null || echo "false"`
RED=`tput setaf 1`
GREEN=`tput setaf 2`
NC=`tput sgr0` # No Color
echo "
#====================================#
# #
# ${GREEN}Installing WPAustralia.org 🐨🐍🕷🇦🇺${NC} #
# #
#====================================#
"
# Check required programs & install.
if [[ $HAS_GIT = "false" || $HAS_VAGRANT = "false" || $HAS_VIRTUALBOX = "false" ]]; then
echo "${GREEN}Requirements not met, installing missing dependencies...${NC}"
if [[ $HAS_BREW = "false" ]]; then
echo "\n⏱ Installing brew.sh"
/usr/bin/ruby "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
if [[ $HAS_GIT = "false" ]]; then
echo "\n⏱ Installing Git"
brew install git
fi
if [[ $HAS_VAGRANT = "false" ]]; then
echo "\n⏱ Installing Vagrant"
brew cask install vagrant
vagrant plugin install vagrant-vbguest
fi
if [[ $HAS_VIRTUALBOX = "false" ]]; then
echo "\n⏱ Installing Virtualbox"
brew cask install virtualbox
fi
fi
# Sanity check incase it gets run again
if [[ -d "wpaustralia" ]]; then
echo "\n☠️ ${RED}The wpaustralia directory already exists${NC}"
exit 1
fi
# Clone and configure Chassis
echo "\n🕑 ${GREEN}Fetching Chassis...${NC}"
git clone --recursive git@github.com:Chassis/Chassis.git wpaustralia
cd wpaustralia
wget https://gist.githubusercontent.com/BronsonQuick/18498eb198292aaf77c42ca7730269f4/raw/72807130ada9894d2f1c21cecf8cca4d194607e6/config.local.yaml
# Fetch repo
echo "
🕛 ${GREEN}Cloning wpaustralia repository.
You may be prompted for your github username and password.${NC}
"
git clone --recursive git@github.com:wpaustralia/wpaustralia.org.git content
echo "\n🕕 ${GREEN}Bringing up virtual machine, this can take some time...Seriously like 10 mins or so, make a flat white and some vegemite on toast.${NC}"
# Spin up the site
vagrant up
if [[ $? != 130 && $? != 0 ]]; then
echo "${RED}There was a problem while bringing up the VM. Please log an issue: https://github.com/wpaustralia/wpaustralia.org/issues. ${NC}"
exit $?
fi
open http://wpaustralia.local/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment