This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
/
manage.sh
executable file
·80 lines (66 loc) · 1.85 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]]; then
command -v greadlink >/dev/null 2>&1 || { echo >&2 "greadlink not found. Install using 'brew install coreutils'"; exit 1; }
BASE_DIR="$(dirname "$(greadlink -f "$0")")"
else
BASE_DIR="$(dirname "$(readlink -f "$0")")"
fi
PYTHONPATH=$BASE_DIR
KICADMODTREE_DIR="$BASE_DIR/KicadModTree"
ACTION=$1
update_packages() {
pip install --upgrade -r "$BASE_DIR/requirements.txt"
}
update_dev_packages() {
update_packages
pip install --upgrade -r "$BASE_DIR/requirements-dev.txt"
}
pep8_check() {
echo ''
echo '[!] Running pep8 check'
pep8 --max-line-length=120 "$KICADMODTREE_DIR/"
}
flake8_check() {
echo ''
echo '[!] Running flake8 check'
flake8 "$KICADMODTREE_DIR/"
}
unit_tests() {
echo ''
echo '[!] Running unit tests'
python "$KICADMODTREE_DIR/tests/test.py"
}
py_test_coverage() {
echo '[!] Running python test coverage'
PYTHONPATH=`pwd` python -m nose2 -C --coverage "$KICADMODTREE_DIR" --coverage-report term-missing -s "$KICADMODTREE_DIR/tests"
}
tests() {
set -e
unit_tests
pep8_check
set +e
}
help() {
[ -z "$1" ] || printf "Error: $1\n"
echo ''
echo "Searx manage.sh help
Commands
========
help - This text
pep8_check - pep8 validation
flake8_check - flake8 validation
unit_tests - Run unit tests
py_test_coverage - Unit test coverage
tests - Run all tests
update_packages - Check & update production dependency changes
update_dev_packages - Check & update development and production dependency changes
"
}
#[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
# && help "action not found" \
# || $ACTION
if [ -n "$(type -t $ACTION)" ] && [ "$(type -t $ACTION)" = function ]; then
$ACTION
else
help "action not found"
fi