annotate DataTables-1.9.4/scripts/make.sh @ 1:440f4aa3db97 draft

Added option to dowload iReports
author saskia-hiltemann
date Wed, 30 Jul 2014 07:03:43 -0400
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 #!/bin/sh
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 cd ../media/src
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 # DEFAULTS
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 CLOSURE="/usr/local/closure_compiler/compiler.jar"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 JSDOC="/usr/local/jsdoc/jsdoc"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 CMD=$1
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 MAIN_FILE="../js/jquery.dataTables.js"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 MIN_FILE="../js/jquery.dataTables.min.js"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 VERSION=$(grep " * @version " DataTables.js | awk -F" " '{ print $3 }')
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 echo ""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 echo " DataTables build ($VERSION)"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 echo ""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 IFS='%'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 cp DataTables.js DataTables.js.build
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 echo " Building main script"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 grep "require(" DataTables.js.build > /dev/null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 while [ $? -eq 0 ]; do
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 REQUIRE=$(grep "require(" DataTables.js.build | head -n 1)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 SPACER=$(echo ${REQUIRE} | cut -d r -f 1)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 FILE=$(echo ${REQUIRE} | sed -e "s#^.*require('##g" -e "s#');##")
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 DIR=$(echo ${FILE} | cut -d \. -f 1)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 sed "s#^#${SPACER}#" < ${DIR}/${FILE} > ${DIR}/${FILE}.build
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 sed -e "/${REQUIRE}/r ${DIR}/${FILE}.build" -e "/${REQUIRE}/d" < DataTables.js.build > DataTables.js.out
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 mv DataTables.js.out DataTables.js.build
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 rm ${DIR}/${FILE}.build
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 grep "require(" DataTables.js.build > /dev/null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 done
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 mv DataTables.js.build $MAIN_FILE
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 if [ "$CMD" != "debug" ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 if [ "$CMD" = "jshint" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 echo " JSHint"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 jshint $MAIN_FILE --config ../../scripts/jshint.config
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 if [ $? -ne 0 ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 echo " Errors occured - exiting"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 exit 1
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 else
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 echo " Pass"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 if [ "$CMD" = "compress" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 echo " Minification"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 echo "/*
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 * File: jquery.dataTables.min.js
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 * Version: $VERSION
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 * Author: Allan Jardine (www.sprymedia.co.uk)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 * Info: www.datatables.net
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 * Copyright 2008-2012 Allan Jardine, all rights reserved.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 * This source file is free software, under either the GPL v2 license or a
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 * BSD style license, available at:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 * http://datatables.net/license_gpl2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 * http://datatables.net/license_bsd
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 * This source file is distributed in the hope that it will be useful, but
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 */" > $MIN_FILE
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 java -jar $CLOSURE --js $MAIN_FILE >> $MIN_FILE
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 echo " Min JS file size: $(ls -l $MIN_FILE | awk -F" " '{ print $5 }')"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 if [ "$CMD" = "docs" -o "$CMD" = "" ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 echo " Documentation"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 $JSDOC -d ../../docs -t JSDoc-DataTables $MAIN_FILE
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 if [ "$CMD" = "cdn" ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 echo " CDN"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 if [ -d ../../cdn ]; then
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 rm -Rf ../../cdn
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 mkdir ../../cdn
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 mkdir ../../cdn/css
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 cp $MAIN_FILE ../../cdn
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 cp $MIN_FILE ../../cdn
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 cp ../css/jquery.dataTables.css ../../cdn/css
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 cp ../css/jquery.dataTables_themeroller.css ../../cdn/css
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 cp -r ../images ../../cdn/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 rm ../../cdn/images/Sorting\ icons.psd
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 fi
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 # Back to DataTables root dir
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 cd ../..
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 #
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 # Packaging files
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 #
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 cat <<EOF > package.json
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 "name": "DataTables",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 "version": "${VERSION}",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 "title": "DataTables",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 "author": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 "name": "Allan Jardine",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 "url": "http://sprymedia.co.uk"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 "licenses": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 "type": "BSD",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 "url": "http://datatables.net/license_bsd"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 "type": "GPLv2",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 "url": "http://datatables.net/license_gpl2"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
126 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
127 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128 "dependencies": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 "jquery": "1.4 - 1.8"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
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.",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132 "keywords": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
133 "DataTables",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
134 "DataTable",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
135 "table",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
136 "grid",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
137 "filter",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
138 "sort",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
139 "page",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
140 "internationalisable"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
141 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
142 "homepage": "http://datatables.net"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
143 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
144 EOF
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
145
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
146 cat <<EOF > component.json
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
147 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
148 "name": "DataTables",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
149 "version": "${VERSION}",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
150 "main": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
151 "./media/js/jquery.dataTables.js",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
152 "./media/css/jquery.dataTables.css",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
153 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
154 "dependencies": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
155 "jquery": "~1.8.0"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
156 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
157 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
158 EOF
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
159
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
160
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
161 echo " Done\n"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
162
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
163