Skip to content

Instantly share code, notes, and snippets.

@davidneedham
Last active December 23, 2015 05:38
Show Gist options
  • Save davidneedham/6588091 to your computer and use it in GitHub Desktop.
Save davidneedham/6588091 to your computer and use it in GitHub Desktop.
Git-dev-workflow bash scripts.
#-------------------------------
# GIT DEV WORKFLOW
#
# These commands all have to do with our development server on its.allgoo.de, which takes advantage
# of the excellent Git Dev Workflow by EOSREI (https://github.com/eosrei/git-dev-workflow). The first
# two commands assume that you have your .ssh/config file set up properly and the last command assumes
# that you have your custom Drush aliases file set up (https://gist.github.com/davidneedham/6301151).
#-------------------------------
# Generate the uli for a particular allgoo.de client site
function gdw-uli () {
ssh -t $1 gdw-drush $2 uli;
}
# Clear the cache a particular allgoo.de client site
function gdw-cc () {
ssh -t $1 gdw-drush $2 cc all;
}
# Refresh an environment on its.allgoo.de
# ex: gdw-refresh projectname dev
function gdw-refresh () {
if [[ $2 == local ]]
then
drush sql-sync @ec."$1".dev @ec."$1".local -y &&
echo 'DB SYNC FROM DEV SUCCESSFUL' &&
echo '==================================' &&
drush -y rsync @ec."$1".dev:%files @ec."$1".local:%files --progress &&
echo 'FILES SYNC FROM DEV SUCCESSFUL' &&
echo '=================================='
elif [[ $2 == dev ]]
then
ssh -t "$1" gdw -y db live "$2" &&
echo 'DB SYNC FROM LIVE SUCCESSFUL' &&
echo '==================================' &&
ssh -t "$1" gdw -y files live "$2" &&
echo 'FILES SYNC FROM LIVE SUCCESSFUL' &&
echo '=================================='
elif [[ $2 == test ]]
then
ssh -t "$1" gdw -y db live "$2" &&
echo 'DB SYNC FROM LIVE SUCCESSFUL' &&
echo '==================================' &&
ssh -t "$1" gdw -y files live "$2" &&
echo 'FILES SYNC FROM LIVE SUCCESSFUL' &&
echo '==================================' &&
ssh -t "$1" gdw -y pull "$2" &&
echo 'GIT PULL SUCCESSFUL' &&
echo '=================================='
elif [[ $2 == live ]]
then
ssh -t "$1" gdw -y pull "$2" &&
echo 'GIT PULL SUCCESSFUL'
fi
}
@davidneedham
Copy link
Author

Updated the git-refresh script to update test properly by pulling code from dev and db from live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment