summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build
diff options
context:
space:
mode:
Diffstat (limited to 't/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build')
-rwxr-xr-xt/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build b/t/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build
new file mode 100755
index 0000000..13f30ca
--- /dev/null
+++ b/t/recipes/checks/cruft/cruft-minified-js/build-spec/pre-build
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Create all the various junk that shouldn't exist in the diff so that we can
+# trigger all the tags.
+
+set -e
+dir="$1"
+jsdir="$1/usr/share/javascript/"
+srcdir="$1"
+json="$srcdir/debian/missing-sources/json.js"
+uglyjson="$jsdir/json/json.min.js"
+
+mkdir -p "$jsdir"
+mkdir -p "$jsdir/minwithoutsource"
+mkdir -p "$jsdir/jswithoutminext"
+mkdir -p "$jsdir/json"
+mkdir -p "$jsdir/sourced"
+mkdir -p "$jsdir/sourced_variant"
+mkdir -p "$jsdir/jswithoutminextwithoutsource/"
+mkdir -p "$srcdir/src/js"
+mkdir -p "$srcdir/build/js"
+
+# create a js file
+uglifyjs -o "$uglyjson" "$json"
+# fake install of minified js without min.js
+cp "$uglyjson" "$jsdir/jswithoutminext/json.js"
+# fake not sourced
+cp "$uglyjson" "$jsdir/minwithoutsource/notsourced.min.js"
+cp "$uglyjson" "$jsdir/minwithoutsource/subdir.min.js"
+# fake install but not sourced
+cp "$uglyjson" "$jsdir/jswithoutminextwithoutsource/jsonnotsourced.js"
+# fake source and min alone
+cp "$uglyjson" "$jsdir/sourced/sourced.min.js"
+cp "$json" "$jsdir/sourced/sourced.js"
+cp "$uglyjson" "$jsdir/sourced_variant/sourced.min.js"
+cp "$json" "$jsdir/sourced_variant/sourced_orig.js"
+# sourced in parent's parent
+cp "$uglyjson" "$srcdir/build/js/foo.min.js"
+cp "$json" "$srcdir/src/js/foo.js"
+
+cat > $srcdir/src/js/foo.html <<EOF
+<html>
+<head>
+<script>
+// Copyright someone
+EOF
+cat "$uglyjson" >> $srcdir/src/js/foo.html
+cat >> $srcdir/src/js/foo.html <<EOF
+</script>
+</head>
+</html>
+EOF