-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmanage.sh
executable file
·64 lines (50 loc) · 1.15 KB
/
manage.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
60
61
62
63
64
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
set -o allexport
source $DIR/.env
set +o allexport
# exit on errors
set -e
USAGE="$0 COMMAND
COMMANDs
build - build project files needed for deployment
test - run tests
bumpversion [patch|minor|major] [--dry-run]
- bump the version number
"
function bumpversion() {
local part=$1
local dry_run_arg=$2
if ! [[ "$part" =~ ^(patch|minor|major)$ ]]; then
echo "part must be one of [patch|minor|major]"
exit 1
fi
case $dry_run_arg in
"--dry-run")
dry_run="--dry-run --allow-dirty"
;;
"")
;;
*)
echo "unknown argument $dry_run_arg"
exit 1
esac
bump2version $part $dry_run --verbose
}
if [ -z "$1" ]; then
echo "usage: $USAGE"
exit 0
else
if [ "$1" == "build" ]; then
APP_ENV="build" flask cli build-scss
elif [ "$1" == "test" ]; then
echo "running tests..."
pytest --cov=hubgrep .
elif [ "$1" == "bumpversion" ]; then
shift
bumpversion $@
else
echo "usage: $USAGE"
fi
fi
shift