Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save studiocaro/a8fc58554f6cedfb300747659fcf8c0c to your computer and use it in GitHub Desktop.
Save studiocaro/a8fc58554f6cedfb300747659fcf8c0c to your computer and use it in GitHub Desktop.
My workflow contains Bedrock, Sage and Valet from Laravel. The latter is something you'll have to install first, otherwise this script won't work!
#!/bin/sh
echo "πŸŽ‰ πŸ‘ Congrats with the new project! πŸŽ‰ πŸ‘
I'm setting up your fresh WordPress install for you."
# Make new folder
printf "Enter folder name of your choice -> "
read FOLDER
mkdir $FOLDER
cd $FOLDER
# Configure URL (automatic .dev extension) and database
printf "Enter local project name your choice -> "
read NAME
# Install Bedrock
git clone https://github.com/roots/bedrock.git .
# Installing dependencies and default WordPress plugins
composer require "wpackagist-plugin/wordpress-seo"
composer require "wpackagist-plugin/wp-statistics"
composer install
# Create our database
mysql -u root -e "create database $NAME";
# Set up .env file
echo "
DB_NAME=$NAME
DB_USER=root
DB_PASSWORD=
DB_HOST=127.0.0.1
WP_ENV=development
WP_HOME=http://$NAME.dev
WP_SITEURL=\${WP_HOME}/wp
# Generate your keys here: https://roots.io/salts.html
AUTH_KEY='generateme'
SECURE_AUTH_KEY='generateme'
LOGGED_IN_KEY='generateme'
NONCE_KEY='generateme'
AUTH_SALT='generateme'
SECURE_AUTH_SALT='generateme'
LOGGED_IN_SALT='generateme'
NONCE_SALT='generateme'" >.env
# Go to the right folder for Valet
cd ~/Sites/$FOLDER/web
# Set up Valet environment
valet link $NAME
# Configurate Wordpress
wp core install --url=http://$NAME.dev/ --title=WordPress --admin_user=admin --admin_password=mypassword --admin_email=youremail
wp core language install nl_NL --activate
# Install and activate Sage starter theme
cd ~/Sites/$FOLDER/web/app/themes
git clone https://github.com/roots/sage.git $NAME
wp theme activate $NAME
# Install bower and gulp
cd ~/Sites/$FOLDER/web/app/themes/$NAME
bower install
npm install
# End message
echo "You're ready for take-off!
πŸš€ πŸš€ πŸš€ πŸš€ πŸš€
Login: admin
Pass: mypassword"
# Show me the site
open -a "Google Chrome" http://$NAME.dev
# Start developing
gulp
gulp watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment