typos
[dygraphs.git] / generate-combined.sh
... / ...
CommitLineData
1#!/bin/bash
2# Generates a single JS file that's easier to include.
3
4GetSources () {
5 # This list needs to be kept in sync w/ the one in dygraph-dev.js
6 # and the one in jsTestDriver.conf. Order matters, except for the plugins.
7 for F in \
8 dashed-canvas.js \
9 dygraph-options.js \
10 dygraph-layout.js \
11 dygraph-canvas.js \
12 dygraph.js \
13 dygraph-utils.js \
14 dygraph-gviz.js \
15 dygraph-interaction-model.js \
16 dygraph-tickers.js \
17 dygraph-plugin-base.js \
18 plugins/*.js \
19 dygraph-plugin-install.js \
20 datahandler/datahandler.js \
21 datahandler/default.js \
22 datahandler/default-fractions.js \
23 datahandler/bars.js \
24 datahandler/bars-custom.js \
25 datahandler/bars-error.js \
26 datahandler/bars-fractions.js
27 do
28 echo "$F"
29 done
30}
31
32# Pack all the JS together.
33CatSources () {
34 GetSources \
35 | xargs cat \
36 | perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,'
37}
38
39Copyright () {
40 echo '/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */'
41}
42
43CatCompressed () {
44 Copyright
45 CatSources \
46 | java -jar yuicompressor-2.4.2.jar --type js
47}
48
49ACTION="${1:-update}"
50case "$ACTION" in
51ls)
52 GetSources
53 ;;
54cat)
55 Copyright
56 CatSources
57 ;;
58compress*|cat_compress*)
59 CatCompressed
60 ;;
61update)
62 CatCompressed > dygraph-combined.js
63 chmod a+r dygraph-combined.js
64 ;;
65*)
66 echo >&2 "Unknown action '$ACTION'"
67 exit 1
68 ;;
69esac