Skip to content

Instantly share code, notes, and snippets.

@swarad07
Created February 12, 2019 08:55
Show Gist options
  • Save swarad07/6c2bddd720c937c3ab263f5c1c37d5bb to your computer and use it in GitHub Desktop.
Save swarad07/6c2bddd720c937c3ab263f5c1c37d5bb to your computer and use it in GitHub Desktop.
wraith-run.sh
#!/bin/bash
set -eo pipefail
# This script configures wraith and runs wraith.
# Fetching Pantheon URL with env:view command.
PANTHEON_ENVIRONMENT=$(terminus env:view --print "$TERMINUS_SITE.$TERMINUS_ENV")
# Pantheon adds a trailing slash, removing it so it works correctly with sed.
PANTHEON_ENVIRONMENT=${PANTHEON_ENVIRONMENT::-1}
echo "New Pantheon environment is "$PANTHEON_ENVIRONMENT;
echo "Updating the config file with new environment."
# Using @ as delimiter instead of / to avoid issues with escaping / in the URL.
sed -i "s@PR_PANTHEON_DOMAIN@$PANTHEON_ENVIRONMENT@" .circleci/scripts/wraith-scripts/capture_msusa.yaml
echo "Begin Configuring Wraith."
mkdir wraith
cd wraith
mkdir shots
wraith setup
echo "Changing javascript/wait--phantom.js"
sed -i 's/2000/10000/' javascript/wait--phantom.js
echo "Moving msusa config file inside wraith directory."
mv ../.circleci/scripts/wraith-scripts/capture_msusa.yaml configs
# Run command to publish the nodes.
# Enable module to active custom drush command.
#terminus -n drush "$TERMINUS_SITE.dev" -- en -y ms_drush_commands
#terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- en -y ms_drush_commands
# Publish test nodes on dev site as well as the new site created by PR.
# TODO: Add node ids for the test nodes.
# terminus -n drush "$TERMINUS_SITE.dev" -- publish-nodes 123
# terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- publish-nodes 123
echo "Run Wraith."
wraith capture configs/capture_msusa.yaml
# Unpublish test nodes.
# Unplublish test nodes on both sites.
# terminus -n drush "$TERMINUS_SITE.dev" -- unpublish-nodes 123
# terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- unpublish-nodes 123
# Uninstall module.
#terminus -n drush "$TERMINUS_SITE.dev" -- pm-uninstall -y ms_drush_commands
#terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- pm-uninstall -y ms_drush_commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment