Skip to content
Newer
Older
100755 99 lines (75 sloc) 2.82 KB
3ba61d3 @DataTables First commit of Visual Event 2
authored
1 #!/bin/sh
2
3 echo ""
4 if [ "$1" = "-h" ]; then
5 echo " Visual Event build script - usage:
6 ./build.sh [loader-dir] [debug]
7 loader-dir - The web-address of the build files. Note that the build
8 directory name is automatically appended and \"http:\\\\\" is
9 automatically prepended. For example:
10 localhost/VisualEvent/builds - default if no option is provided
11 sprymedia.co.uk/VisualEvent/builds
12 debug - Debug indicator. Will not compress the Javascript
13
14 Example deploy build:
15 ./build.sh sprymedia.co.uk/VisualEvent/builds
16
17 Example debug build:
18 ./build.sh localhost/VisualEvent/builds debug
19 "
20 exit
21 elif [ "$1" = "clean" ]; then
22 echo "Cleaning Visual Event builds"
23 rm -Rf $(pwd)/builds/VisualEvent*
24 exit
25 fi
26
27 # OPTIONS
28 SCRIPT_LOC=$1
29 DEBUG=$2
30
31 if [ "$SCRIPT_LOC" = "debug" ]; then
32 DEBUG="debug"
33 SCRIPT_LOC="localhost/VisualEvent/builds"
34 fi
35
36 if [ -z "$1" ]; then
37 SCRIPT_LOC="localhost/VisualEvent/builds"
38 fi
39
40 # DEFAULTS
0c8bfb1 @DataTables The jQuery parser's method for skipping VisualEvent events was wrong …
authored
41 UGLIFYJS=/Users/allan/node_modules/uglify-js/bin/uglifyjs
5804bdc @DataTables Update build script for "neptune" as the main "base of operations"
authored
42 JSDOC3=/usr/local/jsdoc/jsdoc
3ba61d3 @DataTables First commit of Visual Event 2
authored
43
44 BUILD_DIR=VisualEvent-$(date +%s)
45 BUILD_BASE=$(pwd)/builds
46 BUILD=$(pwd)/builds/${BUILD_DIR}
47 BUILD_JS=${BUILD}/js
48 BUILD_CSS=${BUILD}/css
49 BUILD_DOCS=${BUILD}/docs
50
51 JS=$(pwd)/js
52 CSS=$(pwd)/css
53
54 echo "Building VisualEvent"
55 echo " Creating media directory ${BUILD}"
b38402e @DataTables Create the build directory if needed
authored
56
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
57 mkdir -p "$BUILD"
3ba61d3 @DataTables First commit of Visual Event 2
authored
58
59
60 # JAVASCRIPT
61 echo " Javascript"
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
62 mkdir "$BUILD_JS"
3ba61d3 @DataTables First commit of Visual Event 2
authored
63
64 echo " Combining Javascript files"
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
65 cp "$JS/VisualEvent_Loader.js" "$BUILD_BASE/VisualEvent_Loader.js"
66 cat "$JS/jquery.js" "$JS/shCore.js" "$JS/VisualEvent.js" "$JS"/parsers/*.js > "$BUILD_JS/VisualEvent-jQuery.js"
67 cat "$JS/shCore.js" "$JS/VisualEvent.js" "$JS"/parsers/*.js > "$BUILD_JS/VisualEvent.js"
3ba61d3 @DataTables First commit of Visual Event 2
authored
68
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
69 if [ "$DEBUG" != "debug" -a -e $UGLIFYJS ]; then
3ba61d3 @DataTables First commit of Visual Event 2
authored
70 echo " Compressing Javascript"
71 $UGLIFYJS $BUILD_BASE/VisualEvent_Loader.js > $BUILD_BASE/VisualEvent_Loader.min.js
72 $UGLIFYJS $BUILD_JS/VisualEvent-jQuery.js > $BUILD_JS/VisualEvent-jQuery.min.js
73 $UGLIFYJS $BUILD_JS/VisualEvent.js > $BUILD_JS/VisualEvent.min.js
74
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
75 mv "$BUILD_BASE/VisualEvent_Loader.min.js" "$BUILD_BASE/VisualEvent_Loader.js"
76 mv "$BUILD_JS/VisualEvent-jQuery.min.js" "$BUILD_JS/VisualEvent-jQuery.js"
77 mv "$BUILD_JS/VisualEvent.min.js" "$BUILD_JS/VisualEvent.js"
3ba61d3 @DataTables First commit of Visual Event 2
authored
78 fi
79
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
80 sed "s#__BUILD_URL__#http://${SCRIPT_LOC}/${BUILD_DIR}#g" "$BUILD_BASE/VisualEvent_Loader.js" > "$BUILD_BASE/VisualEvent_Loader.tmp.js"
81 mv "$BUILD_BASE/VisualEvent_Loader.tmp.js" "$BUILD_BASE/VisualEvent_Loader.js"
3ba61d3 @DataTables First commit of Visual Event 2
authored
82
83
84 # CSS
85 echo " Combining CSS files"
8a88625 @victor-homyakov Fixed build for path with spaces (e.g. ~/My workspace/VisualEvent/). …
victor-homyakov authored
86 mkdir "$BUILD_CSS"
87 cat "$CSS/VisualEvent.css" "$CSS/shCore.css" > "$BUILD_CSS/VisualEvent.css"
3ba61d3 @DataTables First commit of Visual Event 2
authored
88
89
90 # Docs
91 if [ -e $JSDOC3 -a "$DEBUG" != "debug" ]; then
92 echo " Documentation"
5804bdc @DataTables Update build script for "neptune" as the main "base of operations"
authored
93 $JSDOC3 -d $BUILD_DOCS -t JSDoc-DataTables $JS/VisualEvent.js $JS/VisualEvent_Loader.js
3ba61d3 @DataTables First commit of Visual Event 2
authored
94 fi
95
96 echo "Done :-)"
97 echo ""
98
Something went wrong with that request. Please try again.