-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·69 lines (55 loc) · 1.15 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·69 lines (55 loc) · 1.15 KB
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
#!/bin/bash
SCRIPT_NAME=$(basename $0)
# Function to output usage information.
usage() {
cat << EOF
Usage: $SCRIPT_NAME [OPTION]
Deploys the web site.
Options:
-a
deploy everything.
-h
display this help and exit
Note:
By default the images and documents directories are not deployed.
These directories rarely change and take most of the space.
EOF
exit 1
}
# Function to ouput an error message.
error() {
echo $SCRIPT_NAME: $1. See "$SCRIPT_NAME -h".
exit 1
}
# Parse options.
while getopts ha currOption
do
case $currOption in
h) usage
;;
a) DEPLOY=all
;;
*) error "$currOption is not a valid option"
;;
esac
done
# Exit on error.
set -o errexit
# Generate the static site.
echo Cleaning out directory...
docpad clean
echo Generating static site...
docpad generate
# Execute Grunt file.
grunt
cd out
if [ "$DEPLOY" != "all" ]; then
# Delete images
rm -rf images
# Delete documents
rm -rf documents
fi
FILENAME=elm_$(date +%Y%m%d).zip
# Compress everything into a zipped archive.
zip -r $FILENAME *
curl --silent --ftp-create-dirs -T $FILENAME -u $FTP_USER:$FTP_PASSWORD $FTP_URL