File:  [LON-CAPA] / loncom / html / adm / LC_math_editor / build.sh
Revision 1.2: download - view: text, annotated - select for diffs
Tue Feb 24 15:20:36 2015 UTC (9 years, 5 months ago) by damieng
Branches: MAIN
CVS tags: version_2_12_X, HEAD
updated to git version (see git for log history), and changed param separator to ,

    1: #!/bin/bash
    2: 
    3: # this builds dist/LC_math_editor.min.js using google closure compiler.
    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,
   21:         "initEditors": initEditors,
   22:         "updateMathSpanAndDiv": updateMathSpanAndDiv
   23:     });
   24: }();
   25: %
   26: 
   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
   34: NEWFILE="c`date +"%d%m%y"`.js"
   35: /bin/sh ./compressjs.sh -strict $tmp
   36: mv "$NEWFILE" ./dist/LC_math_editor.min.js
   37: rm -f $tmp

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