diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-11-13 11:16:08 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-11-13 11:16:08 +0100 |
commit | 5ca869c3241d159b2bd2c45b79c49b085c277968 (patch) | |
tree | 8146e2a6f6d4b45be7952d2692aaae05e3a877a6 /buildjsdocs.sh | |
parent | a069171cda9f1f0ec129018c15e9696ae44c7154 (diff) | |
parent | 0f3e6cb50af06bf3a64ea7f1abd360c53fa0bf8c (diff) | |
download | nextcloud-server-5ca869c3241d159b2bd2c45b79c49b085c277968.tar.gz nextcloud-server-5ca869c3241d159b2bd2c45b79c49b085c277968.zip |
Merge pull request #9177 from owncloud/jsdocexperiment
Improved JS Docs + added build script for JS Docs
Diffstat (limited to 'buildjsdocs.sh')
-rwxr-xr-x | buildjsdocs.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/buildjsdocs.sh b/buildjsdocs.sh new file mode 100755 index 00000000000..ef18dc8c9a9 --- /dev/null +++ b/buildjsdocs.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# ownCloud +# +# Run JS tests +# +# @author Vincent Petry +# @copyright 2014 Vincent Petry <pvince81@owncloud.com> +# +NPM="$(which npm 2>/dev/null)" +PREFIX="build" +OUTPUT_DIR="build/jsdocs" + +JS_FILES="core/js/*.js apps/*/js/*.js" + +if test -z "$NPM" +then + echo 'Node JS >= 0.8 is required to build the documentation' >&2 + exit 1 +fi + +# update/install test packages +mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" jsdoc || exit 3 + +JSDOC_BIN="$(which jsdoc 2>/dev/null)" + +# If not installed globally, try local version +if test -z "$JSDOC_BIN" +then + JSDOC_BIN="$PREFIX/node_modules/jsdoc/jsdoc.js" +fi + +if test -z "$JSDOC_BIN" +then + echo 'jsdoc executable not found' >&2 + exit 2 +fi + +mkdir -p "$OUTPUT_DIR" + +NODE_PATH="$PREFIX/node_modules" $JSDOC_BIN -d "$OUTPUT_DIR" $JS_FILES + |