-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·59 lines (47 loc) · 1.32 KB
/
build.sh
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
#!/usr/bin/env bash
# Script to automate development build for personal website.
# Copyright (C) 2015 Logan Martel - All Rights Reserved
# Permission to copy and modify is granted under the GNU Apache License 2.0
# Last revised 06/29/2018
# See README.md for further details.
# Note, this script has been modified & based loosely on:
# https://github.com/X1011/git-directory-deploy/blob/master/deploy.sh
set -o errexit # abort if any command fails
scriptname=$(basename "$0")
help_message="\
Usage: $scriptname
Deploy generated files to a git branch.
Options:
-h, --help Show this help information.
"
parse_args() {
# Set args from a local environment file.
if [ -e ".env" ]; then
source .env
fi
# Set args from file specified on the command-line.
if [[ $1 = "-c" || $1 = "--config-file" ]]; then
source "$2"
shift 2
fi
# Parse arg flags
# If something is exposed as an environment variable, set/overwrite it
# here. Otherwise, set/overwrite the internal variable instead.
while : ; do
if [[ $1 = "-h" || $1 = "--help" ]]; then
echo "$help_message"
return 0
else
break
fi
done
}
main() {
parse_args "$@"
# build distribution
coffee --compile javascripts/*.coffee
compass compile sass/*
minify javascripts/ --clean
minify stylesheets/ --clean
}
[[ $1 = --source-only ]] || main "$@"