Skip to content

Instantly share code, notes, and snippets.

@aczietlow
Last active May 2, 2017 18:39
Show Gist options
  • Save aczietlow/672f3f80881ceba5eba3b95b8412e135 to your computer and use it in GitHub Desktop.
Save aczietlow/672f3f80881ceba5eba3b95b8412e135 to your computer and use it in GitHub Desktop.
Docksal command to work with Pantheon
#!/usr/bin/env bash
# Abort if anything fails
set -e
SITE_DIRECTORY="default"
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}"
SITEDIR_PATH="${DOCROOT_PATH}/sites/${SITE_DIRECTORY}"
ARTIFACT_PATH="${PROJECT_ROOT}/artifacts"
CURRENT_VERSION="scylla_test_1.2.0.sql"
# Console colors
red='\033[0;31m'
green='\033[0;32m'
green_bg='\033[42m'
yellow='\033[1;33m'
NC='\033[0m'
echo-red () { echo -e "${red}$1${NC}"; }
echo-green () { echo -e "${green}$1${NC}"; }
echo-green-bg () { echo -e "${green_bg}$1${NC}"; }
echo-yellow () { echo -e "${yellow}$1${NC}"; }
# Fetch a new db if needed.
if [[ ! -f $ARTIFACT_PATH/$CURRENT_VERSION ]]
then
echo -en "${green_bg} Fetching new backup ${NC}"
./bin/terminus backup:create scylla.test
./bin/terminus backup:get scylla.test --element=db --to=$ARTIFACT_PATH/$CURRENT_VERSION.gz
gunzip $ARTIFACT_PATH/$CURRENT_VERSION.gz
fi
# Import db into Drupal.
echo -en "${green_bg} Importing db into Drupal ${NC} "
fin sqli $ARTIFACT_PATH/$CURRENT_VERSION
# Make minor tweaks for local development.
cd $DOCROOT_PATH 2>dev/null
fin drush en diff stage_file_proxy -y
fin drush uli -l scylla.docksal
echo -en "${green_bg} DONE! ${NC} "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment