Created
April 4, 2016 17:54
-
-
Save mattsims/e125dfdd171d3c82c94cfee17e79ddd8 to your computer and use it in GitHub Desktop.
Bash script to prepare a site for WP Engine
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 -e | |
clear | |
echo "=================================================================" | |
echo "WP Engine Preparation Script" | |
echo "=================================================================" | |
# accept user input for the databse name | |
echo "WP Engine install name: " | |
read -e wpeinstall | |
shopt -s extglob | |
if [ -d "core" ]; then | |
cd core/ | |
mv !(wp-content) ../ | |
cd ../ | |
rm -rf core/ | |
echo "Moved WordPress core files into parent directory" | |
fi | |
shopt -u extglob | |
if [ -d "content" ] && [ ! -d "wp-content" ]; then | |
mv content/ wp-content/ | |
echo "Renamed WordPress content folder" | |
fi | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -m "Revert to standard WordPress install structure ready for migration to WP Engine." | |
echo "Reverted to standard WP install structure ready for migration to WP Engine" | |
fi | |
if ! git config remote.production.url > /dev/null; then | |
git remote add production [email protected]:production/$wpeinstall.git | |
echo "Added WP Engine git push production remote" | |
fi | |
if ! git config remote.staging.url > /dev/null; then | |
git remote add staging [email protected]:staging/$wpeinstall.git | |
echo "Added WP Engine git push staging remote" | |
fi | |
wget https://wpengine.com/wp-content/uploads/2013/10/recommended-gitignore-no-wp.txt -O - >> .gitignore | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -m "Add WP Engine ignore rules." | |
echo "Added WP Engine .gitignore rules" | |
fi | |
git ls-files --ignored --exclude-standard -z|xargs -0 git rm --cached | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -m "Untrack ignored files." | |
echo "Untracked newly-ignored files" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment