manage.sh 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. BASE_DIR=$(dirname `readlink -f $0`)
  3. PYTHONPATH=$BASE_DIR
  4. SEARX_DIR="$BASE_DIR/searx"
  5. ACTION=$1
  6. update_packages() {
  7. pip install --upgrade -r "$BASE_DIR/requirements.txt"
  8. }
  9. update_dev_packages() {
  10. pip install --upgrade -r "$BASE_DIR/requirements-dev.txt"
  11. }
  12. pep8_check() {
  13. echo '[!] Running pep8 check'
  14. pep8 --max-line-length=120 "$SEARX_DIR" "$BASE_DIR/tests"
  15. }
  16. unit_tests() {
  17. echo '[!] Running unit tests'
  18. python -m nose2 -s "$BASE_DIR/tests/unit"
  19. }
  20. py_test_coverage() {
  21. echo '[!] Running python test coverage'
  22. PYTHONPATH=`pwd` python -m nose2 -C --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit"
  23. coverage report
  24. coverage html
  25. }
  26. robot_tests() {
  27. echo '[!] Running robot tests'
  28. PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot
  29. }
  30. tests() {
  31. set -e
  32. pep8_check
  33. unit_tests
  34. robot_tests
  35. set +e
  36. }
  37. build_style() {
  38. lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
  39. }
  40. styles() {
  41. echo '[!] Building styles'
  42. build_style themes/default/less/style.less themes/default/css/style.css
  43. build_style themes/default/less/style-rtl.less themes/default/css/style-rtl.css
  44. build_style themes/courgette/less/style.less themes/courgette/css/style.css
  45. build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
  46. build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
  47. build_style themes/oscar/less/oscar/oscar.less themes/oscar/css/oscar.min.css
  48. build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
  49. }
  50. grunt() {
  51. grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
  52. }
  53. locales() {
  54. pybabel compile -d "$SEARX_DIR/translations"
  55. }
  56. $ACTION