From 778eb91d92c6fe80a09b978b97076095e9cb60f1 Mon Sep 17 00:00:00 2001 From: Alexey Gladkov Date: Sat, 12 May 2012 00:17:09 +0400 Subject: [PATCH 1/2] Add UglifyJS Add a JavaScript parser/compressor/beautifier as submodule: https://github.com/mishoo/UglifyJS Signed-off-by: Alexey Gladkov --- .gitmodules | 3 +++ uglifyjs | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 uglifyjs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..28a3ad8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "uglifyjs"] + path = uglifyjs + url = https://github.com/mishoo/UglifyJS.git diff --git a/uglifyjs b/uglifyjs new file mode 160000 index 0000000..ef4d776 --- /dev/null +++ b/uglifyjs @@ -0,0 +1 @@ +Subproject commit ef4d776aedee6cbc8959a8e76403b82523615d3a From a791c8c2a41210bb3488b19b6cd8068866f92775 Mon Sep 17 00:00:00 2001 From: Alexey Gladkov Date: Sat, 12 May 2012 01:07:24 +0400 Subject: [PATCH 2/2] Add install script Signed-off-by: Alexey Gladkov --- install.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..59644f8 --- /dev/null +++ b/install.sh @@ -0,0 +1,39 @@ +#!/bin/sh -eu + +myname="$(readlink -ev "$0")" +compiler='uglifyjs/bin/uglifyjs' + +SOURCES='cfg css img lib tpl index.php' +JSDIR='js' + +if [ "$#" -eq 0 ]; then + printf 'Usage: %s \n' "${0##*/}" + exit +fi + +destdir="$1" +shift + +if [ ! -d "$destdir" ]; then + printf 'Error: %s: Not directory\n' "$destdir" + exit 1 +fi +destdir="$(readlink -ev "$destdir")" + +cd "${myname%/*}" +cp -aurt "$destdir" -- $SOURCES + +mkdir -p -- "$destdir/js" +for src in "$JSDIR"/*.js; do + [ -f "$src" ] || + continue + printf 'Processing %s ... ' "$src" + + rc='done' + $compiler -nc -c -o "$destdir/js/${src##*/}" "$src" || rc='fail' + + printf '%s\n' "$rc" + + [ "$rc" = 'done' ] || + exit 1 +done