# REMOTE ... HOME="/home/tstfwd/public_preview/autobase.com" REMOTE_REPO_URL="http://svn.adaptainc.com" LOCAL_REPO_URL="http://127.0.0.1:8888" JAVA=$(which java) COMPRESSOR="$HOME/site/bin/yuicompressor.jar" if [[ $JAVA = "" ]] ; then echo "warning: can not found java" else if [[ ! -f $COMPRESSOR ]] ; then echo "warning: can not found compressor file '${COMPRESSOR}'" else cd $HOME/www CHANGED_CSS_JS=`svn st -u --non-interactive --ignore-externals | grep '^\s*\*' | awk '{if ($3 == "") print $2; else print $3}' | grep -E '\.(css|js)$'` fi fi echo echo "> updating site..." if [ -d "$HOME/site" ] ; then cd $HOME/site svn up --ignore-externals --accept theirs-full else cd $HOME svn co $LOCAL_REPO_URL/autobasedata.com/trunk/site --ignore-externals fi echo echo "> updating public_html..." cd $HOME/www if [ -d "$HOME/www/.svn" ] ; then svn up --ignore-externals --accept theirs-full else svn co $LOCAL_REPO_URL/autobasedata.com/trunk/www . --ignore-externals fi mv --force $HOME/www/_lib/server.local.config.php $HOME/www/_lib/local.config.php mv --force $HOME/www/.htaccess_preview $HOME/www/.htaccess echo echo "> updating externals..." echo "- bin" if [ -d $HOME/site/bin ] ; then cd $HOME/site/bin svn up --accept theirs-full else cd $HOME/site svn co $LOCAL_REPO_URL/Quick_Site_Framework/tags/release-4/site/bin fi echo "- lib/Zend" if [ -d $HOME/site/lib/Zend ] ; then cd $HOME/site/lib/Zend svn up --accept theirs-full else cd $HOME/site/lib svn co $LOCAL_REPO_URL/Quick_Site_Framework/tags/release-4/site/lib/Zend fi echo "- lib/AuthorizeNet" if [ -d $HOME/site/lib/AuthorizeNet ] ; then cd $HOME/site/lib/AuthorizeNet svn up --accept theirs-full else cd $HOME/site/lib svn co $LOCAL_REPO_URL/Quick_Site_Framework/tags/release-4/site/lib/AuthorizeNet fi echo "- lib/Smarty/Smarty" if [ -d $HOME/site/lib/Smarty/Smarty ] ; then cd $HOME/site/lib/Smarty/Smarty svn up --accept theirs-full else cd $HOME/site/lib/Smarty svn co $LOCAL_REPO_URL/Quick_Site_Framework/tags/release-4/site/lib/Smarty/Smarty fi echo echo "> cleaning cache..." cd $HOME/site/tmp/cache rm -f ./zend_cache* cd $HOME/site/tmp/tpl_c rm -f ./%* echo echo "> packing css, js files..." cd $HOME/www if [[ -n $CHANGED_CSS_JS ]] ; then for FILE in $CHANGED_CSS_JS do if [ -f $FILE ] ; then EXT=$(echo $FILE | sed 's/.*\.//') OUT=$(echo $FILE | sed "s/$EXT$/pack\.$EXT/") echo "compressing $FILE -> $OUT" ## $JAVA -jar $COMPRESSOR $FILE -o $OUT 2>&1 $JAVA -jar $COMPRESSOR $FILE -o $OUT fi done fi echo echo "> removing *.pack.merge.css, *.pack.merge.css files..." find ./js -type f -name '*.pack.merge.js' -exec rm -f {} \; find ./css -type f -name '*.pack.merge.css' -exec rm -f {} \; echo echo "> creating rev file..." SOURCE_REV=$(svn info http://127.0.0.1:8888/autobasedata.com/trunk --non-interactive 2>&1 | grep "Last Changed Rev:" | awk '{print $4}') echo $SOURCE_REV > rev echo echo "> done" echo echo "Preview URL: autobase.1.preview.adaptainc.com" echo