Merge branch 'release-1.0.0' of github.com:danvk/dygraphs into release-1.0.0
[dygraphs.git] / generate-combined.sh
CommitLineData
6a1aa64f
DV
1#!/bin/bash
2# Generates a single JS file that's easier to include.
43f15770 3
1beeb310
KW
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 strftime/strftime-min.js \
9 rgbcolor/rgbcolor.js \
10 stacktrace.js \
11 dashed-canvas.js \
12 dygraph-options.js \
13 dygraph-layout.js \
14 dygraph-canvas.js \
15 dygraph.js \
16 dygraph-utils.js \
17 dygraph-gviz.js \
18 dygraph-interaction-model.js \
19 dygraph-tickers.js \
20 dygraph-plugin-base.js \
21 plugins/*.js \
22 dygraph-plugin-install.js
23 do
24 echo "$F"
25 done
26}
27
74a5af31 28# Pack all the JS together.
1beeb310
KW
29CatSources () {
30 GetSources \
31 | xargs cat \
32 | perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,'
33}
74a5af31 34
1beeb310
KW
35Copyright () {
36 echo '/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */'
37}
b2a516b8 38
1beeb310
KW
39CatCompressed () {
40 Copyright
41 CatSources \
42 | java -jar yuicompressor-2.4.2.jar --type js
43}
b2a516b8 44
1beeb310
KW
45ACTION="${1:-update}"
46case "$ACTION" in
47ls)
48 GetSources
49 ;;
50cat)
51 Copyright
52 CatSources
53 ;;
54compress*|cat_compress*)
55 CatCompressed
56 ;;
57update)
b78c3349
DV
58 CatCompressed > dygraph-min.js
59 chmod a+r dygraph-min.js
1beeb310
KW
60 ;;
61*)
62 echo >&2 "Unknown action '$ACTION'"
63 exit 1
64 ;;
65esac