Skip to content

Instantly share code, notes, and snippets.

@aliselcuk
Created July 12, 2019 03:13
Show Gist options
  • Save aliselcuk/6e3bc1b2add6d606ca9b5be321438267 to your computer and use it in GitHub Desktop.
Save aliselcuk/6e3bc1b2add6d606ca9b5be321438267 to your computer and use it in GitHub Desktop.
Script to link composer repository
#!/bin/bash
if [ ! -d addons ]; then
exit 0;
fi
WORKBENCH=$(grep SV_WORKBENCH .env | cut -d '=' -f 2-)
if [[ ! "$WORKBENCH" ]]; then
echo "Workbench not enabled"
exit 0;
fi
DIR=`php -r "echo __DIR__;"`
PACKAGE_DIR=${DIR}'/vendor/superv/platform'
WORKBENCH_DIR=${DIR}'/addons/superv/platform'
# if package is installed,
# and it is not a Git repo!
if [ -d ${PACKAGE_DIR} ] && [ ! -d ${PACKAGE_DIR}/.git ]; then
echo "removing ${PACKAGE_DIR}"
rm -Rf ${PACKAGE_DIR}
fi
# if package dir is removed above or does not exist
# link workbench to package dir
if [ -d ${WORKBENCH_DIR} ] && [ ! -d ${PACKAGE_DIR} ]; then
echo "linking ${WORKBENCH_DIR} to ${PACKAGE_DIR}"
ln -s ${WORKBENCH_DIR} ${PACKAGE_DIR}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment