forked from mathquill/mathquill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·73 lines (67 loc) · 1.58 KB
/
build.sh
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
73
#!/bin/bash
if [ ! -d build ]; then
mkdir build \
&& echo "No build/ directory, made one for ya" >/dev/stderr
fi
if [ "$1" == "HEAD" ]; then
STASH="$(git stash)"
echo "$STASH"
fi
echo "cat src/{blah,blah}.js > build/mathquill.js # not literally"
cat \
src/intro.js \
src/baseclasses.js \
src/rootelements.js \
src/commands.js \
src/symbols.js \
src/cursor.js \
src/publicapi.js \
src/outro.js \
> build/mathquill.js
if [ "$1" == "cat" ]; then
exit
elif [ "$1" == "HEAD" ]; then
if [ "$STASH" != "No local changes to save" ]; then
git stash pop
fi
fi
echo "uglifyjs build/mathquill.js > build/mathquill.min.js"
uglifyjs build/mathquill.js \
> build/mathquill.min.js \
|| echo "\
___________________
/ i no has uglifyjs \\
\\ i no can minify /
-------------------
\\
\\
/\\_)o<
| \\
| O . O |
\\_____/" \
>/dev/stderr
# created with cowsay
if [ "$1" == "publish" ]; then
cp mathquill.css build/mathquill.css
STASH="$(git stash)"
echo "$STASH"
BRANCH="$(git status | head -1)"
COMMIT="$(git show -s --oneline)"
git checkout gh-pages
echo "git pull origin gh-pages"
git pull origin gh-pages
cp build/* .
rm build/mathquill.css
if [ "$BRANCH" != "# Not currently on any branch" ]; then
BRANCH="$(echo "$BRANCH" | cut -d ' ' -f 4)"
git commit -am "publish latest $BRANCH $COMMIT"
else
git commit -am "publish detached $COMMIT"
fi
echo "git push origin gh-pages"
git push origin gh-pages
git checkout -
if [ "$STASH" != "No local changes to save" ]; then
git stash pop
fi
fi