forked from increpare/PuzzleScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile
executable file
·129 lines (125 loc) · 3.73 KB
/
compile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#node-qunit-phantomjs tests/tests.html --timeout 40
echo ===========================
start=`date +%s`
echo clearing whitepsace from demos
cd demo
find . -type f \( -name "*.txt" \) -exec perl -p -i -e "s/[ \t]*$//g" {} \;
cd ..
echo removing bin
rm -rf ../bin
mkdir ../bin
echo inlining standalone template
./inline
echo copying files
cp -r * ../bin/
cp .htaccess ../bin/
echo optimizing pngs
rm ../bin/images/*.png
cd images
./minimize
cd ../
echo optimizing gifs
cd ../bin/Documentation/images
./minimize
cd ../../../src
echo removing files
rm -rf ../bin/js/*
rm -rf ../bin/css/*
rm -rf ../bin/tests
rm -rf ../bin/Levels
rm ../bin/compile
rm ../bin/inline
rm ../bin/images/minimize
rm ../bin/Documentation/images/minimize
rm ../bin/standalone.html
echo compressing css
cd css
./concat
cd ../
mv css/combined.css ../bin/css/combined.css
java -jar ~/progs/yuicompressor-2.4.8.jar ../bin/css/combined.css > ../bin/css/combined2.css
mv ../bin/css/combined2.css ../bin/css/combined.css
java -jar ~/progs/yuicompressor-2.4.8.jar ../bin/Documentation/css/bootstrap.css > ../bin/Documentation/css/bootstrap_compressed.css
mv ../bin/Documentation/css/bootstrap_compressed.css ../bin/Documentation/css/bootstrap.css
echo running google closure compiler
java -jar ~/progs/closure.jar --js_output_file ../bin/js/scripts_compiled.js \
--js js/Blob.js \
--js js/FileSaver.js \
--js js/jsgif/b64.js \
--js js/jsgif/LZWEncoder.js \
--js js/jsgif/NeuQuant.js \
--js js/jsgif/GIFEncoder.js \
--js js/debug.js \
--js js/globalVariables.js \
--js js/font.js \
--js js/rng.js \
--js js/riffwave.js \
--js js/sfxr.js \
--js js/codemirror/codemirror.js \
--js js/codemirror/active-line.js \
--js js/codemirror/dialog.js \
--js js/codemirror/search.js \
--js js/codemirror/searchcursor.js \
--js js/codemirror/match-highlighter.js \
--js js/codemirror/show-hint.js \
--js js/codemirror/anyword-hint.js \
--js js/colors.js \
--js js/graphics.js \
--js js/inputoutput.js \
--js js/mobile.js \
--js js/buildStandalone.js \
--js js/engine.js \
--js js/parser.js \
--js js/editor.js \
--js js/compiler.js \
--js js/console.js \
--js js/soundbar.js \
--js js/toolbar.js \
--js js/layout.js \
--js js/addlisteners.js \
--js js/addlisteners_editor.js \
--js js/makegif.js
java -jar ~/progs/closure.jar --js_output_file ../bin/js/scripts_play_compiled.js \
--js js/globalVariables.js \
--js js/debug_off.js \
--js js/font.js \
--js js/rng.js \
--js js/riffwave.js \
--js js/sfxr.js \
--js js/codemirror/codemirror.js \
--js js/colors.js \
--js js/graphics.js \
--js js/engine.js \
--js js/parser.js \
--js js/compiler.js \
--js js/inputoutput.js \
--js js/mobile.js
echo running sed
sed -e 's/<script src="js\/[A-Za-z0-9_\/-]*\.js"><\/script>//g' < editor.html > editor_temp1.html
sed -e 's/<!--TOREPLACE-->/<script src="js\/scripts_compiled.js"><\/script>/g' < editor_temp1.html > editor_temp2.html
sed -e 's/<link rel="stylesheet" href="[A-Za-z0-9_\/-]*\.css">//g' < editor_temp2.html > editor_temp3.html
sed -e 's/<!--CSSREPLACE-->/<link rel="stylesheet" href="css\/combined.css">/' < editor_temp3.html > editor_temp4.html
sed -e 's/<script src="js\/[A-Za-z0-9_\/-]*\.js"><\/script>//g' < play.html > play_temp1.html
sed -e 's/<!--TOREPLACE-->/<script src="js\/scripts_play_compiled.js"><\/script>/g' < play_temp1.html > play_temp2.html
echo copying editor.html over
mv editor_temp4.html ../bin/editor.html
mv play_temp2.html ../bin/play.html
echo compressing html
java -jar ~/progs/htmlcompressor-1.5.3.jar -r ../bin/ -o ../bin/
echo tidying up
rm editor_temp*.html
rm play_temp*.html
echo gzipping site
cd ../bin
./gzipper
rm README.md
rm gzipper
rm commit
cd ../src
end=`date +%s`
runtime=$((end-start))
time=`date "+%H:%M:%S"`
echo script end time : $time
echo script took $runtime seconds
echo ===========================