Commit a97355ad465d3510f86d673b61610793f37f0abc
- Diff rendering mode:
- inline
- side by side
tools/build_and_copy_weblibs.sh
(0 / 108)
|   | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | ### | ||
| 4 | ## Copies necessary js files for development/distribution | ||
| 5 | |||
| 6 | BASEDIR=$1 | ||
| 7 | TARGETDIR=$2 | ||
| 8 | |||
| 9 | if [ -z "$TARGETDIR" ] ; then | ||
| 10 | echo "Usage: $(basename $0) <base directory> <target_dir>" | ||
| 11 | echo "example: $(basename $0) ./websrc ./data/webroot/js" | ||
| 12 | exit 1 | ||
| 13 | fi | ||
| 14 | |||
| 15 | SPROCKETS=$(which sprocketize) | ||
| 16 | if [ ! -x "$SPROCKETS" ] ; then | ||
| 17 | echo "error: need ruby sprocketize" | ||
| 18 | exit 1 | ||
| 19 | fi | ||
| 20 | |||
| 21 | # make sure our submodules are here | ||
| 22 | cd $BASEDIR | ||
| 23 | git submodule update --init | ||
| 24 | cd - | ||
| 25 | |||
| 26 | $SPROCKETS -I $BASEDIR/dss-setup-interface/ $BASEDIR/dss-setup-interface/dss-setup-interface.js > "$TARGETDIR/dss-setup-interface.js" | ||
| 27 | |||
| 28 | $SPROCKETS -I $BASEDIR/dss-setup-interface/ $BASEDIR/dss-setup-interface/dss-overview-page.js > "$TARGETDIR/dss-overview-page.js" | ||
| 29 | |||
| 30 | RAKE=$(which rake) | ||
| 31 | if [ ! -x "$RAKE" ] ; then | ||
| 32 | echo "error: need ruby rake" | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | |||
| 36 | # if prototype is present | ||
| 37 | if [ -d "$BASEDIR/thirdparty/prototype" ] ; then | ||
| 38 | cd "$BASEDIR/thirdparty/prototype" | ||
| 39 | # build prototype | ||
| 40 | if $RAKE dist && [ -f "dist/prototype.js" ]; then | ||
| 41 | cd - | ||
| 42 | mkdir -p "$TARGETDIR/lib/prototype" | ||
| 43 | cp $BASEDIR/thirdparty/prototype/dist/prototype.js "$TARGETDIR/lib/prototype/" | ||
| 44 | else | ||
| 45 | echo "could not build prototype.js" | ||
| 46 | exit 1 | ||
| 47 | fi | ||
| 48 | fi | ||
| 49 | |||
| 50 | MAKE=$(which make) | ||
| 51 | if [ ! -x "$RAKE" ] ; then | ||
| 52 | echo "error: need ruby make" | ||
| 53 | exit 1 | ||
| 54 | fi | ||
| 55 | |||
| 56 | # if jquery is present | ||
| 57 | if [ -d "$BASEDIR/thirdparty/jquery" ] ; then | ||
| 58 | cd "$BASEDIR/thirdparty/jquery" | ||
| 59 | # build prototype | ||
| 60 | if $MAKE && [ -f "dist/jquery.min.js" ]; then | ||
| 61 | cd - | ||
| 62 | mkdir -p "$TARGETDIR/lib/jquery" | ||
| 63 | cp $BASEDIR/thirdparty/jquery/dist/jquery.min.js "$TARGETDIR/lib/jquery/" | ||
| 64 | else | ||
| 65 | echo "could not build prototype.js" | ||
| 66 | exit 1 | ||
| 67 | fi | ||
| 68 | fi | ||
| 69 | |||
| 70 | # if extjs is present | ||
| 71 | if [ -d "$BASEDIR/thirdparty/extjs" ] ; then | ||
| 72 | mkdir -p "$TARGETDIR/lib/extjs" | ||
| 73 | cp $BASEDIR/thirdparty/extjs/ext-all.js "$TARGETDIR/lib/extjs/" | ||
| 74 | cp $BASEDIR/thirdparty/extjs/ext-all-debug.js "$TARGETDIR/lib/extjs/" | ||
| 75 | cp -r $BASEDIR/thirdparty/extjs/adapter "$TARGETDIR/lib/extjs/" | ||
| 76 | cp -r $BASEDIR/thirdparty/extjs/resources "$TARGETDIR/lib/extjs/" | ||
| 77 | fi | ||
| 78 | |||
| 79 | # if flot is present | ||
| 80 | if [ -d "$BASEDIR/thirdparty/flot" ] ; then | ||
| 81 | mkdir -p "$TARGETDIR/lib" | ||
| 82 | (cd $BASEDIR/thirdparty; tar cf - --exclude .git ./flot) | ( cd $TARGETDIR/lib; tar xfp -) | ||
| 83 | fi | ||
| 84 | |||
| 85 | # install extjs customizing if it exists | ||
| 86 | if [ -d "$BASEDIR/customizing/extjs/resources" ]; then | ||
| 87 | set -x | ||
| 88 | cp -r $BASEDIR/customizing/extjs/resources "$TARGETDIR/lib/extjs/" | ||
| 89 | fi | ||
| 90 | |||
| 91 | # install translations | ||
| 92 | if [ -d "$BASEDIR/customizing/LC_MESSAGES" ]; then | ||
| 93 | set -x | ||
| 94 | mkdir -p "$TARGETDIR/lib/LC_MESSAGES/de_DE" | ||
| 95 | cp $BASEDIR/customizing/LC_MESSAGES/*.json "$TARGETDIR/lib/LC_MESSAGES/" | ||
| 96 | cp $BASEDIR/customizing/LC_MESSAGES/de_DE/* "$TARGETDIR/lib/LC_MESSAGES/de_DE" | ||
| 97 | fi | ||
| 98 | |||
| 99 | |||
| 100 | # if jsgettext is present | ||
| 101 | if [ -d "$BASEDIR/thirdparty/jsgettext" ] ; then | ||
| 102 | # build prototype | ||
| 103 | mkdir -p "$TARGETDIR/lib/jsgettext" | ||
| 104 | cp $BASEDIR/thirdparty/jsgettext/Gettext.js "$TARGETDIR/lib/jsgettext/" | ||
| 105 | else | ||
| 106 | echo "could not find Gettext.js" | ||
| 107 | exit 1 | ||
| 108 | fi |

