diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-01-10 19:49:37 +0100 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2016-01-10 19:49:37 +0100 |
| commit | db615aa1a36cb5e136f6c264295a6e59f7466a9d (patch) | |
| tree | d2b914aba39f9a095dcd0e7bc305c848605d18fb /manage.sh | |
| parent | 66f48c2bf5b84f6f7b52b1ba7217a1aadf5717b7 (diff) | |
| parent | c873ddd7fbbc6275d6f4eb5ff873768bf9c8a48c (diff) | |
Merge remote-tracking branch 'origin/install-refactor'
Diffstat (limited to 'manage.sh')
| -rwxr-xr-x | manage.sh | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/manage.sh b/manage.sh new file mode 100755 index 000000000..7890f98ec --- /dev/null +++ b/manage.sh @@ -0,0 +1,94 @@ +#!/bin/sh + +BASE_DIR=$(dirname `readlink -f $0`) +PYTHONPATH=$BASE_DIR +SEARX_DIR="$BASE_DIR/searx" +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 '[!] Running pep8 check' + pep8 --max-line-length=120 "$SEARX_DIR" "$BASE_DIR/tests" +} + +unit_tests() { + echo '[!] Running unit tests' + python -m nose2 -s "$BASE_DIR/tests/unit" +} + +py_test_coverage() { + echo '[!] Running python test coverage' + PYTHONPATH=`pwd` python -m nose2 -C --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" + coverage report + coverage html +} + +robot_tests() { + echo '[!] Running robot tests' + PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot +} + +tests() { + set -e + pep8_check + unit_tests + robot_tests + set +e +} + +build_style() { + lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2" +} + +styles() { + echo '[!] Building styles' + build_style themes/default/less/style.less themes/default/css/style.css + build_style themes/default/less/style-rtl.less themes/default/css/style-rtl.css + build_style themes/courgette/less/style.less themes/courgette/css/style.css + build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css + build_style less/bootstrap/bootstrap.less css/bootstrap.min.css + build_style themes/oscar/less/oscar/oscar.less themes/oscar/css/oscar.min.css + build_style themes/pix-art/less/style.less themes/pix-art/css/style.css +} + +grunt_build() { + grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js" +} + +locales() { + pybabel compile -d "$SEARX_DIR/translations" +} + +help() { + [ -z "$1" ] || echo "Error: $1\n" + echo "Searx manage.sh help + +Commands +======== + grunt_build - Build js files + help - This text + locales - Compile locales + pep8_check - Pep8 validation + py_test_coverage - Unit test coverage + robot_tests - Run selenium tests + styles - Build less files + tests - Run all python tests (pep8, unit, robot) + unit_tests - Run unit tests + update_dev_packages - Check & update development only dependency changes + update_packages - Check & update dependency changes +" +} + +if type $ACTION 1>/dev/null; then + $ACTION +else + help "action not found" +fi |