#!/bin/bash
################################################################################
#                                  deploy                                      #
################################################################################
#                                                                              #
#  DESCRIPTION:  Quick script to consistently and reliably upload releases     #
#                to our website.                                               #
#                                                                              #
#  AUTHOR:       Mark Zieg <mzieg@wasatchphotonics.com>                        #
#                                                                              #
################################################################################

read -p "Username: " USERNAME
read -p "Version:  " VERSION 

# verify version number in module
if egrep -q "$VERSION" wasatch/__init__.py
then
    echo "Correct version in __init__.py"
else
    echo "Can't find $VERSION in __init__.py"
    exit 1
fi

# verify version number is tagged
if git tag | egrep -q $VERSION
then
    echo "Git tag found"
else
    echo "Git tag not found: $VERSION"
    exit 1
fi

# render documentation 
export VERSION
make doc

# echo
# read -p "Press return to continue..." FOO

# upload documentation
rsync --archive doxygen/html/ ${USERNAME}@wasatchphotonics.com:www/api/Wasatch.PY/

echo
echo "View via:"
echo
echo "    http://www.wasatchphotonics.com/api/Wasatch.PY/"
