Last active
March 22, 2018 08:48
-
-
Save BronsonQuick/4c7fd31b851da4fc28ea296f0eb95868 to your computer and use it in GitHub Desktop.
A script to setup wpaustralia.org
This file contains hidden or 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
#!/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 [email protected]: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 [email protected]: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