updated on Wed Jan 25 12:16:47 UTC 2012
[aur-mirror.git] / jsdoc-toolkit / jsdoc
blob85fc28ebf0976897dab0ddf46aacadb4c4b41465
1 #!/bin/sh
3 # launcher script for jsdoc
4 # Author: Avi Deitcher
5 # Modified by Georges Khaznadar <georgesk@ofset.org>
7 # This program is released under the MIT License as follows:
9 # Copyright (c) 2008-2009 Atomic Inc <avi@jsorm.com>
10 # Copyright (c) 2011 Georges Khaznadar
12 #Permission is hereby granted, free of charge, to any person
13 #obtaining a copy of this software and associated documentation
14 #files (the "Software"), to deal in the Software without
15 #restriction, including without limitation the rights to use,
16 #copy, modify, merge, publish, distribute, sublicense, and/or sell
17 #copies of the Software, and to permit persons to whom the
18 #Software is furnished to do so, subject to the following
19 #conditions:
21 #The above copyright notice and this permission notice shall be
22 #included in all copies or substantial portions of the Software.
24 #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26 #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
28 #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29 #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 #OTHER DEALINGS IN THE SOFTWARE.
34 check_mandatory_option(){
35 for a in "$@"; do
36 if [ "$a" = -h ] || [ "$a" = --help ]; then ok=1; fi
37 outdir=$(echo "$a" | sed -n 's/-d=\(.\+\)/-d="\1"/p')
38 if [ -n "$outdir" ];
39 then
40 ok=1
41 else
42 outdir=$(echo "$a" | sed -n 's/--directory=\(.\+\)/--directory="\1"/p')
43 if [ -n "$outdir" ];
44 then
45 ok=1
48 done
50 if ! [ "$ok" = 1 ]; then
51 echo "An argument like -d=<directory> or --directory=<directory> is mandatory!"
52 echo "Try 'jsdoc --help' or 'man jsdoc' for more information."
53 exit 1
57 check_mandatory_option $@
59 if [ -n "$JSDOCDIR" ]; then
60 _DOCDIR="-Djsdoc.dir=$JSDOCDIR"
61 else
62 _DOCDIR=""
65 if [ -n "$JSDOCTEMPLATEDIR" ]; then
66 _TDIR="-Djsdoc.template.dir=$JSDOCTEMPLATEDIR"
67 else
68 _TDIR="-Djsdoc.template.dir=/usr/share/jsdoc-toolkit/templates/jsdoc"
71 CMD="java $_DOCDIR $_TDIR -cp /usr/share/java/jsrun.jar:/usr/share/java/js.jar JsRun /usr/share/jsdoc-toolkit/app/run.js $@"
72 echo $CMD
73 $CMD