1
0

buildjsdocs.sh 794 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. #
  3. # ownCloud
  4. #
  5. # Run JS tests
  6. #
  7. # @author Vincent Petry
  8. # @copyright 2014 Vincent Petry <pvince81@owncloud.com>
  9. #
  10. NPM="$(which npm 2>/dev/null)"
  11. PREFIX="build"
  12. OUTPUT_DIR="build/jsdocs"
  13. JS_FILES="core/js/*.js apps/*/js/*.js"
  14. if test -z "$NPM"
  15. then
  16. echo 'Node JS >= 0.8 is required to build the documentation' >&2
  17. exit 1
  18. fi
  19. # update/install test packages
  20. mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" jsdoc || exit 3
  21. JSDOC_BIN="$(which jsdoc 2>/dev/null)"
  22. # If not installed globally, try local version
  23. if test -z "$JSDOC_BIN"
  24. then
  25. JSDOC_BIN="$PREFIX/node_modules/jsdoc/jsdoc.js"
  26. fi
  27. if test -z "$JSDOC_BIN"
  28. then
  29. echo 'jsdoc executable not found' >&2
  30. exit 2
  31. fi
  32. mkdir -p "$OUTPUT_DIR"
  33. NODE_PATH="$PREFIX/node_modules" $JSDOC_BIN -d "$OUTPUT_DIR" $JS_FILES