#! /bin/ksh
## $Id: deploy.sh 225 2011-08-13 21:16:20Z stuart $
##
## Author: Stuart Connolly (stuconnolly.com)
## Copyright (c) 2011 Stuart Connolly. All rights reserved.
##
## Paramters: <none>
##
## Description: Deploys the built plugin depending on the build configuration being used.
SIMBL_DIR='Application Support/SIMBL/Plugins'
BUILD_PATH="${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}"
PLUGIN_PATH="${USER_LIBRARY_DIR}/${SIMBL_DIR}/${FULL_PRODUCT_NAME}"
if [ ! -d "${USER_LIBRARY_DIR}/${SIMBL_DIR}" ]
then
echo "SIMBL plugin directory does not exist at '${USER_LIBRARY_DIR}/${SIMBL_DIR}' so creating it..."
mkdir "${USER_LIBRARY_DIR}/${SIMBL_DIR}"
fi
# Clean up any previous products/symbolic links in SIMBL's plugin directory
if [ -e "$PLUGIN_PATH" ]
then
rm -rf "$PLUGIN_PATH"
fi
# Depending on the build configuration, either copy or link to the most recent build
if [ "$CONFIGURATION" == 'Development' ]
then
# If we are developing, add a symbolic link to the plugin
ln -sf "$BUILD_PATH" "$PLUGIN_PATH"
elif [ "$CONFIGURATION" == 'Release' ]
then
# If we are compiling for release, copy the plugin to SIMBL's plugin directory
cp -rpf "$BUILD_PATH" "$PLUGIN_PATH"
fi
exit 0