#!/usr/bin/zsh
# Description: Upload my site
# Author: Mark Triggs <mst@dishevelled.net>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

for i in ~/.elisp/homebrew/{dot*,*.el}
  do
  diff -I dishevelled.net $i ~/projects/site/elisp/`basename $i` > /dev/null 2> /dev/null
  if [ $? != 0 ]; then
      echo need to re-upload $i
      cp $i ~/projects/site/elisp/$(basename $i)
  fi
done

for i in ~/.sawfish/homebrew/{dot*,*.jl}
  do
  diff -I dishevelled.net $i ~/projects/site/sawfish/`basename $i` > /dev/null 2> /dev/null
  if [ $? != 0 ]; then
      echo need to re-upload $i
      cp $i ~/projects/site/sawfish/$(basename $i)
  fi
done

for i in ~/projects/site/shots/*.(jpg|png|gif)
  do
  if [ ! -f ~/projects/site/shots/thumbs/`basename $i` ]; then
      convert -geometry 300x3000 $i \
          ~/projects/site/shots/thumbs/`basename $i`
  fi
done

for i in ~/projects/site/shots/thumbs/*.(jpg|png|gif)
  do
  if [ ! -f ~/projects/site/shots/`basename $i` ]; then
      echo -n "Removing $i.. "
      rm -f $i
      echo "done"
  fi
done


sitecopy --update personal
