From c7dc656b2bf956758dbf8979ff6b7597d627b884 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 23 Jun 2014 23:57:44 +0200 Subject: [PATCH] Added script to build the JS documentation --- .gitignore | 1 + buildjsdocs.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 buildjsdocs.sh diff --git a/.gitignore b/.gitignore index a36fd98b79f..c0d44301d57 100644 --- a/.gitignore +++ b/.gitignore @@ -89,6 +89,7 @@ nbproject # nodejs /build/lib/ +/build/jsdocs/ /npm-debug.log 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 +# +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 +