Skip to content

Instantly share code, notes, and snippets.

@ryankinal
Created December 1, 2017 16:39
Show Gist options
  • Save ryankinal/3375dc6b9bf146eaf057c4e19b805b88 to your computer and use it in GitHub Desktop.
Save ryankinal/3375dc6b9bf146eaf057c4e19b805b88 to your computer and use it in GitHub Desktop.
Copies course listings code to a pantheon environment.

This script should be downloaded and customized to your local environment. The script copies code from the course listings plugin (as defined on line 16) to a temp directory, does some cleanup, and then copies it to a default site (line 3) or to the specified site (with the -s option).

Usage

cltowp [-s [site]] [-n]

Options

  • -s - Copies the course listings code to the provided site
  • -n - Copies vendor and node_modules directories in addition to source code
#!/bin/sh
nodemodules=false
site="test-wordpress"
while getopts ":ns:" opt; do
case "${opt}" in
n)
nodemodules=true
;;
s)
site=$OPTARG
;;
esac
done
mkdir ~/temp/wp-course-listings
cd ~/projects/colibri/wp-course-listings/src
echo "Copying plugin to temp..."
cp -rf * ~/temp/wp-course-listings
echo " done\n"
cd ~/temp/wp-course-listings
echo "Removing unnecessary files..."
rm -rf .git
rm -f compose.sh
rm -f composer.json
rm -f composer.lock
echo " done\n"
if [ "$nodemodules" = false ]
then
echo "Removing node_modules..."
rm -rf node_modules
echo " done\n"
echo "Removing vendor... "
rm -rf vendor
echo " done\n"
fi
echo "Copying to ~/projects/colibri/$site/wp-content/plugins/course-listing/ ..."
cp -rf * ~/projects/colibri/$site/wp-content/plugins/course-listing/
echo " done\n"
echo "Cleaning up... "
rm -rf ~/temp/wp-course-listings
echo " done\n"
echo "Deploy complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment