-
-
Save mboynes/97b0b36ced5bc0458910 to your computer and use it in GitHub Desktop.
wp wrapper for vagrant
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 | |
ARGS="$@" | |
DIR=`pwd 2>&1` | |
if [[ $DIR == *www* ]]; then | |
if [[ $ARGS != *--url* ]]; then | |
SITE=`pwd | sed 's/.*\/www\///' | cut -d "/" -f 1 2>&1` | |
if [[ $SITE == "wordpress" ]]; then | |
ARGS="$ARGS --url=wp.dev" | |
elif [[ $SITE == "trunk" ]]; then | |
ARGS="$ARGS --url=trunk.dev" | |
elif [[ $SITE != "" ]]; then | |
ARGS="$ARGS --url=$SITE.alley.dev" | |
fi | |
fi | |
DIR=`pwd | sed 's/.*\/www\//\/var\/www\//' 2>&1` | |
else | |
if [[ $ARGS != *--url* ]]; then | |
THEME=`pwd | sed 's/.*\/themes\/\(vip\/\)*//' | cut -d "/" -f 1 2>&1` | |
if [[ $THEME != "" ]]; then | |
ARGS="$ARGS --url=$THEME.wp.dev" | |
else | |
ARGS="$ARGS --url=wp.dev" | |
fi | |
fi | |
DIR="/var/www/wordpress/" | |
fi | |
echo "cd $DIR; wp $ARGS" | |
vagrant ssh -c "cd $DIR; wp $ARGS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment