1
0

buildjsdocs.sh 764 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env 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. OUTPUT_DIR="jsdocs"
  12. JS_FILES="../core/js/*.js ../core/js/**/*.js ../apps/*/js/*.js"
  13. if test -z "$NPM"
  14. then
  15. echo 'Node JS >= 0.8 is required to build the documentation' >&2
  16. exit 1
  17. fi
  18. # update/install test packages
  19. $NPM install --prefix . --link jsdoc || exit 3
  20. JSDOC_BIN="$(which jsdoc 2>/dev/null)"
  21. # If not installed globally, try local version
  22. if test -z "$JSDOC_BIN"
  23. then
  24. JSDOC_BIN="./node_modules/jsdoc/jsdoc.js"
  25. fi
  26. if test -z "$JSDOC_BIN"
  27. then
  28. echo 'jsdoc executable not found' >&2
  29. exit 2
  30. fi
  31. mkdir -p "$OUTPUT_DIR"
  32. NODE_PATH="./node_modules" $JSDOC_BIN -d "$OUTPUT_DIR" $JS_FILES