Created
October 18, 2010 16:40
-
-
Save sbeam/632541 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# for each file in site/public/ dir, link it to the main /public dir so it can be edited directly. | |
# | |
# This script should be run AFTER the server is started, not before. | |
# | |
# | |
for FILE in vendor/extensions/site/public/[jsi]**/*; do | |
DIR=${FILE%/*} | |
PUB=public/${DIR##*/}/${FILE##*/} | |
if [ -d $FILE ]; then | |
echo "$FILE is a directory, skipping." | |
elif [ -L $FILE ]; then | |
echo "WARNING: $FILE is already a symlink. Not changed."; | |
else | |
diff -q $PUB $FILE | |
if [ "$?" != "0" ]; then | |
echo "ERROR: won't clobber" | |
exit 1 | |
else | |
echo "Linking $FILE" | |
ln -sf ../../../../../$PUB $FILE | |
fi | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# reverses the effects of prep-symlinks.sh by finding every symlink in vendor/extensions/site/public/ | |
# and copying the target on top of the link. | |
# | |
# This script needs to be run BEFORE restarting the server, or committing changes to git. | |
# | |
for LINK in vendor/extensions/site/public/[jsi]**/*; do | |
if [ -L $LINK ]; then | |
DIR=${LINK%/*} | |
PUB=public/${DIR##*/}/${LINK##*/} | |
if [ ! -f $PUB ]; then | |
echo "ERROR: Broken link from $LINK ??" | |
exit 1 | |
else | |
rm $LINK | |
cp $PUB $LINK | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment