summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/files/source-missing/cruft-minified-js/build-spec/pre-build
blob: 13f30cab1a9267f2333a37696e8537bba0aa5b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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