Annotation of loncom/html/adm/LC_math_editor/build.sh, revision 1.2

1.1       damieng     1: #!/bin/bash
                      2: 
1.2     ! damieng     3: # this builds dist/LC_math_editor.min.js using google closure compiler.
1.1       damieng     4: # It must be run in the math_editor directory.
                      5: 
                      6: cd "$(dirname "$0")"
                      7: mkdir -p dist
                      8: tmp=$(mktemp)
                      9: cat <<% >$tmp
                     10: "use strict";
                     11: var LCMATH = function () {
                     12: %
                     13: cat src/*.js >>$tmp
                     14: cat <<% >>$tmp
                     15:     return({
                     16:         "Definitions": Definitions,
                     17:         "ENode": ENode,
                     18:         "Operator": Operator,
                     19:         "ParseException": ParseException,
                     20:         "Parser": Parser,
1.2     ! damieng    21:         "initEditors": initEditors,
        !            22:         "updateMathSpanAndDiv": updateMathSpanAndDiv
1.1       damieng    23:     });
                     24: }();
                     25: %
                     26: 
1.2     ! damieng    27: # use the local application if Java is available
        !            28: if hash java 2>/dev/null; then
        !            29:     java -jar lib/compiler.jar --language_in=ECMASCRIPT5_STRICT --compilation_level=SIMPLE_OPTIMIZATIONS $tmp >dist/LC_math_editor.min.js
        !            30:     exit 0
        !            31: fi
        !            32: 
        !            33: # otherwise use the web service with compressjs.sh
1.1       damieng    34: NEWFILE="c`date +"%d%m%y"`.js"
1.2     ! damieng    35: /bin/sh ./compressjs.sh -strict $tmp
1.1       damieng    36: mv "$NEWFILE" ./dist/LC_math_editor.min.js
                     37: rm -f $tmp

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>