forked from rufuspollock-okfn/bubbletree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make
executable file
·72 lines (59 loc) · 1.45 KB
/
make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
#
# this is the make script for the BubbleTree
# it requires installation of node.js with the following
# modules installed:
#
# - jshint, for checking the js syntax
# - uglify-js, for js minification
# - markdown-js, for translation of readme.md to index.html
#
# Usage:
# just run ./make and be happy
#
#
set -e
OUTFILE=build/bubbletree.js
MINFILE=build/bubbletree.min.js
README=index.html
echo "Checking JS files"
while read LINE
do
jshint $LINE --reporter buildtools/reporter.js
done < manifest
echo "Combining JS files"
DATE=`date +%s`
TMP=tmp_$DATE
TMPFILE=$TMP/tmp.js
mkdir $TMP
touch $TMPFILE
while read LINE
do
cat $LINE >> $TMPFILE
done < manifest
cp $TMPFILE $OUTFILE
echo "Compressing JS files"
uglifyjs -o $MINFILE $TMPFILE
echo "Updating index.html from readme"
markdown readme.md -f $TMP/readme.html.body
rm $README
touch index.html
cat buildtools/readme.html.head >> $README
cat $TMP/readme.html.body >> $README
cat buildtools/readme.html.foot >> $README
# create index file for demos
DEMOS=demos/*
touch $TMP/demos.md
rm demos/index.html
for f in $DEMOS
do
# take action on each file. $f store current file name
echo "* [${f:6}](${f:6}/index.html)" >> $TMP/demos.md
done
markdown $TMP/demos.md -f $TMP/demos.html.body
touch demos/index.html
cat buildtools/demos.html.head > demos/index.html
cat $TMP/demos.html.body >> demos/index.html
cat buildtools/demos.html.foot >> demos/index.html
# remove temporary folder
rm -Rf $TMP