1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70#!/bin/bash
#
set -ue
VERSION=$(git log -1 --pretty=format:%H)
if [ -n "$(git status --porcelain)" ]
then
VERSION="dirty-$VERSION"
fi
git status
echo
echo -e "Hit [ENTER] to continue: \c"
read
SCRIPTS_DIR=$( dirname $0 )
ROOT_DIR=$( dirname $SCRIPTS_DIR )
APPCFG=$(which appcfg.py) \
|| (echo "ERROR: appcfg.py must be in your PATH"; exit 1)
while [ -L $APPCFG ]
do
APPCFG=$(readlink $APPCFG)
done
BIN_DIR=$(dirname $APPCFG)
if [ "$(basename $BIN_DIR)" == "bin" ]
then
SDK_HOME=$(dirname $BIN_DIR)
if [ -d $SDK_HOME/platform/google_appengine ]
then
SDK_HOME=$SDK_HOME/platform/google_appengine
fi
else
SDK_HOME=$BIN_DIR
fi
function get_app_id() {
local app_id
app_id=$( cat $ROOT_DIR/app.yaml | egrep '^application:' | sed 's/application: *\([0-9a-z][-0-9a-z]*[0-9a-z]\).*/\1/' )
while [ $# -gt 0 ]
do
if [ "$1" == "-A" ]
then
shift
app_id=$1
elif [ "${1/=*/}" == "--application" ]
then
app_id=${1/--application=/}
fi
shift
done
echo $app_id
}
APP_ID=$(get_app_id $*)
echo
echo "Using app id: $APP_ID"
echo -e "\n*** Rolling back any pending updates (just in case) ***\n"
appcfg.py --oauth2 $* rollback .
echo -e "\n*** DEPLOYING ***\n"
appcfg.py --oauth2 $* update -V $VERSION .
echo -e "\n*** SETTING DEFAULT VERSION ***\n"
appcfg.py --oauth2 $* set_default_version -V $VERSION .