aboutsummaryrefslogtreecommitdiffstats
path: root/buildjsdocs.sh
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-23 23:57:44 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-31 13:27:36 +0100
commitc7dc656b2bf956758dbf8979ff6b7597d627b884 (patch)
tree30c7cbbe5aaecd6c4b4bf9c4e525c71d7921d1fa /buildjsdocs.sh
parente0528c7598bc98ae951f4a6a44b126bbfabd8f3b (diff)
downloadnextcloud-server-c7dc656b2bf956758dbf8979ff6b7597d627b884.tar.gz
nextcloud-server-c7dc656b2bf956758dbf8979ff6b7597d627b884.zip
Added script to build the JS documentation
Diffstat (limited to 'buildjsdocs.sh')
-rwxr-xr-xbuildjsdocs.sh42
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
+