Last active
October 5, 2016 18:11
-
-
Save sloanlance/672a9404da20a8abd55c0a61c047c439 to your computer and use it in GitHub Desktop.
PHP, SVN: Watch a Subversion repo and automatically update the working copy when changes are committed. An old, old hack that fulfilled a need at one time. Clever, but I could do better now. SMDH
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 -- | |
# While working with PHP applications, there were a few obstacles to | |
# local development. It wasn't possible/easy to get an Oracle server | |
# or Oracle client for PHP to run under Mac OS X. Furthermore, the | |
# local environment didn't have the authenticated user's name available | |
# in the environment. Although an odd situation, it was easier to | |
# develop on the local machine, commit to SVN, then update a copy of | |
# the project running on a server that supported Oracle, CoSign, etc. | |
# The following script, run in the project directory of the server | |
# with the project checked out using a "file:///" URL, would check | |
# the repository for updates once every second, apply them, and update | |
# the version.txt file with the current SVN version and time: | |
sleepTime='0.25s' | |
tempfile="/tmp/svnup.$$" | |
echo 'svn continuous update' | |
echo "Starting with revision `svnversion`." | |
echo "`svnversion` on `date '+%F %T'`" > version.txt | |
while [ 1 ]; do | |
svn up > $tempfile | |
numupdates=`wc -l < $tempfile` | |
if [ "$numupdates" -ne "1" ]; then | |
tput bel | |
cat $tempfile | |
date '+%F %T' | |
echo "`svnversion` on `date '+%F %T'`" > version.txt | |
fi | |
printf -- '/\r' | |
sleep $sleepTime | |
printf -- '-\r' | |
sleep $sleepTime | |
printf -- '\\\r' | |
sleep $sleepTime | |
printf -- '|\r' | |
sleep $sleepTime | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment