-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·84 lines (62 loc) · 1.27 KB
/
run.sh
File metadata and controls
executable file
·84 lines (62 loc) · 1.27 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# usage: ./run.sh command [argument ...]
#
# Executable documentation for the development workflow.
#
# See https://death.andgravity.com/run-sh for how this works.
# preamble
set -o nounset
set -o pipefail
set -o errexit
PROJECT_ROOT=${0%/*}
if [[ $0 != $PROJECT_ROOT && $PROJECT_ROOT != "" ]]; then
cd "$PROJECT_ROOT"
fi
readonly PROJECT_ROOT=$( pwd )
readonly SCRIPT="$PROJECT_ROOT/$( basename "$0" )"
# main development workflow
function install {
pip install -e . --group dev --upgrade --upgrade-strategy eager
pre-commit install --install-hooks
}
function test {
pytest "$@"
}
function test-all {
tox p "$@"
}
function coverage {
unset -f coverage
coverage run -m pytest "$@"
coverage html
coverage report
}
function typing {
mypy "$@"
}
# "watch" versions of the main commands
function test-dev {
watch test "$@"
}
function typing-dev {
watch typing "$@"
}
# utilities
function watch {
entr-project-files -cdr "$SCRIPT" "$@"
}
function entr-project-files {
set +o errexit
while true; do
ls-project-files | entr "$@"
if [[ $? -eq 0 ]]; then
break
fi
done
}
function ls-project-files {
git ls-files "$@"
git ls-files --exclude-standard --others "$@"
}
"$@"