Last active
January 22, 2020 16:04
-
-
Save 1stevengrant/3de5f23f06add6d7c88d91f133c886ab to your computer and use it in GitHub Desktop.
I was helping a friend get a Statamic instance running locally today.
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 -euo pipefail | |
echo "About to install the things Statamic needs to run locally..." | |
echo -n "Do you want to clear previous settings? (y/n)" | |
read answer | |
if echo "$answer" | grep -iq "^y"; then | |
echo "Clearing out previous settings..." | |
valet uninstall | |
rm -rf ~/.valet | |
rm -rf ~/.composer | |
rm -rf /usr/local/bin/composer | |
echo "Uninstalling Homebrew and its packages" | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" | |
else | |
# HOMEBREW | |
echo "Installing Homebrew" | |
# Check for Homebrew and install if we don't have it | |
if test ! $(which brew); then | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
# ================================================================== | |
# PACKAGES | |
# ================================================================== | |
cd ~ | |
echo "Installing and configuring Homebrew packages" | |
homebrew_packages=( | |
"php", | |
"nodejs" | |
) | |
for homebrew_package in "${homebrew_packages[@]}"; do | |
brew install "$homebrew_package" | |
done | |
# ================================================================== | |
# Laravel | |
# ================================================================== | |
echo "Starting Laravel configuration" | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
echo "Install global Composer packages" | |
/usr/local/bin/composer global require laravel/installer | |
echo "Install Laravel Valet" | |
composer global require consolidation/cgr | |
export PATH="$PATH:$HOME/.composer/vendor/bin" >> ~/.bash_profile | |
cgr laravel/valet | |
valet install | |
mkdir ~/Sites | |
git clone https://github.com/statamic/statamic-starter.git | |
rm -rf statamic-starter/.git | |
cd ~/Sites | |
valet park && valet domain test && cd ~ | |
echo "Valet config complete" | |
cd ~/Sites/statamic-starter | |
composer install | |
cp .env.example .env | |
php artisan key:generate | |
npm install && npm run dev | |
echo "Opening the website" | |
/usr/bin/open -a "/Applications/Google Chrome.app/" 'http://statamic-starter.test' | |
echo "Refreshing your profile" | |
source ~/.bash_profile | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment