So at work we are finalizing the setup of a new server environment. The site is in PHP and the code is all in SVN. We were trying to decide what process to use to export the SVN contents to the site and that’s where I decided to learn how to write a bash script. This is my first and with some help from Jess we created the following script. The script does the following:
- Does an info on the remote repo to get the revision number
- Checks against local revision number which is stored in a file
- If the revision numbers don’t match, it does a diff on both revisions and creates an list with the files that were changed
- It then loops through each file and exports it to the site
- Finally it stores the new revision number in the file
# need to figure out what to do on files that need to be deleted
TARGET_DIR=‘/path/to/site’
REPO="svn://path.to.svn/repo"
REVISION_FILE=‘.revision’
echo "Getting info from remote repo"
REMOTE_VERSION=$(svn info $REPO | grep Revision)
REMOTE_VERSION=${REMOTE_VERSION: -4} # need to update to not hardcode 4 spaces back
CURRENT_VERSION=$(more $REVISION_FILE)
echo "Current Revision: $CURRENT_VERSION"
echo "Remote Revision: $REMOTE_VERSION"
if [ "$REMOTE_VERSION" -eq "$CURRENT_VERSION" ]
then
echo "No export needed"
exit 0
fi
echo "Getting diffs between revisions"
difflines=`svn diff –summarize -r $CURRENT_VERSION:$REMOTE_VERSION $REPO 2>&1 | awk ‘{print $2}’`
URL_LENGTH=${#REPO}
for i in `echo $difflines`; do
FILENAME=${i:$URL_LENGTH}
echo "svn export ${i} ${TARGET_DIR}${FILENAME}"
svn export ${i} ${TARGET_DIR}${FILENAME}
done
echo "Saving revision number"
echo ${REMOTE_VERSION} > $REVISION_FILE

I asked around our local user group what conference they would recommend if they could only attend one PHP conference and this was the one I heard the most good things about. This was my first time attending a PHP conference and it was WELL worth it. The sessions were great with three tracks daily to choose from. The conference was small enough where you could spend time with the presenters interacting and asking questions. I met a bunch of new people which made the whole experience that much better. There was always something to do during presentations as well as after hours.
I took a one day-8 hour course on using Flash Builder and wow… I’m sold. After working on Flash for so many years, Flex is just too amazing to ignore. The class was taught by Adobe certified
Not much to mention here other than it was my birthday last month as well so had dinners with parents and drinks with friends. I have been running a lot lately so I bought myself a nice new watch with my birthday money: 





