Skip to content

Instantly share code, notes, and snippets.

@brockboland
Created July 2, 2011 06:17
Show Gist options
  • Save brockboland/1059789 to your computer and use it in GitHub Desktop.
Save brockboland/1059789 to your computer and use it in GitHub Desktop.
Drupal dev site: deploy from template
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: ./deploy drupal_version, for example: ./deploy 6"
else
versionname=d$1
deploydir=~/src/templates/$versionname
sitesdir=$versionname.local
sitesfullpath=~/Sites/$sitesdir
dbname=dev_$versionname
if [ -d "$deploydir" ]; then
echo "Re-deploying from site template"
echo "STICK AROUND - there's a sudo call in here so we need your password"
echo "Re-create the DB, so no stray tables are left behind"
mysql -uuser -ppass -e "DROP DATABASE $dbname"
mysql -user -ppass -e "CREATE DATABASE $dbname"
echo "Import DB"
mysql -uuser -ppass $dbname < $deploydir/db.sql
echo "Untar files"
cd ~/Sites
sudo rm -rf $sitesdir
tar xfz $deploydir/files.tar
echo "Clear caches"
drush @$sitesdir cache-clear all
else
echo "The deploy directory can't be found: $deploydir"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment