6 CLOSURE="/usr/local/closure_compiler/compiler.jar"
7 JSDOC="/usr/local/jsdoc/jsdoc"
10 MAIN_FILE="../js/jquery.dataTables.js"
11 MIN_FILE="../js/jquery.dataTables.min.js"
12 VERSION=$(grep " * @version " DataTables.js | awk -F" " '{ print $3 }')
15 echo " DataTables build ($VERSION)"
21 cp DataTables.js DataTables.js.build
23 echo " Building main script"
24 grep "require(" DataTables.js.build > /dev/null
25 while [ $? -eq 0 ]; do
26 REQUIRE=$(grep "require(" DataTables.js.build | head -n 1)
28 SPACER=$(echo ${REQUIRE} | cut -d r -f 1)
29 FILE=$(echo ${REQUIRE} | sed -e "s#^.*require('##g" -e "s#');##")
30 DIR=$(echo ${FILE} | cut -d \. -f 1)
32 sed "s#^#${SPACER}#" < ${DIR}/${FILE} > ${DIR}/${FILE}.build
34 sed -e "/${REQUIRE}/r ${DIR}/${FILE}.build" -e "/${REQUIRE}/d" < DataTables.js.build > DataTables.js.out
35 mv DataTables.js.out DataTables.js.build
37 rm ${DIR}/${FILE}.build
39 grep "require(" DataTables.js.build > /dev/null
42 mv DataTables.js.build $MAIN_FILE
45 if [ "$CMD" != "debug" ]; then
46 if [ "$CMD" = "jshint" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
48 jshint $MAIN_FILE --config ../../scripts/jshint.config
50 echo " Errors occured - exiting"
57 if [ "$CMD" = "compress" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
60 * File: jquery.dataTables.min.js
62 * Author: Allan Jardine (www.sprymedia.co.uk)
63 * Info: www.datatables.net
65 * Copyright 2008-2012 Allan Jardine, all rights reserved.
67 * This source file is free software, under either the GPL v2 license or a
68 * BSD style license, available at:
69 * http://datatables.net/license_gpl2
70 * http://datatables.net/license_bsd
72 * This source file is distributed in the hope that it will be useful, but
73 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
74 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
77 java -jar $CLOSURE --js $MAIN_FILE >> $MIN_FILE
78 echo " Min JS file size: $(ls -l $MIN_FILE | awk -F" " '{ print $5 }')"
81 if [ "$CMD" = "docs" -o "$CMD" = "" ]; then
83 $JSDOC -d ../../docs -t JSDoc-DataTables $MAIN_FILE
86 if [ "$CMD" = "cdn" ]; then
88 if [ -d ../../cdn ]; then
93 cp $MAIN_FILE ../../cdn
94 cp $MIN_FILE ../../cdn
95 cp ../css/jquery.dataTables.css ../../cdn/css
96 cp ../css/jquery.dataTables_themeroller.css ../../cdn/css
97 cp -r ../images ../../cdn/
98 rm ../../cdn/images/Sorting\ icons.psd
103 # Back to DataTables root dir
109 cat <<EOF > package.json
111 "name": "DataTables",
112 "version": "${VERSION}",
113 "title": "DataTables",
115 "name": "Allan Jardine",
116 "url": "http://sprymedia.co.uk"
121 "url": "http://datatables.net/license_bsd"
125 "url": "http://datatables.net/license_gpl2"
129 "jquery": "1.4 - 1.8"
131 "description": "DataTables enhances HTML tables with the ability to sort, filter and page the data in the table very easily. It provides a comprehensive API and set of configuration options, allowing you to consume data from virtually any data source.",
140 "internationalisable"
142 "homepage": "http://datatables.net"
146 cat <<EOF > component.json
148 "name": "DataTables",
149 "version": "${VERSION}",
151 "./media/js/jquery.dataTables.js",
152 "./media/css/jquery.dataTables.css",