-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask-runner.sh.command
executable file
·113 lines (101 loc) · 2.2 KB
/
task-runner.sh.command
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# Design-Side Includes (DSI)
#
# To make this file runnable:
# $ chmod +x *.sh.command
banner="Design-Side Includes (DSI)"
projectHome=$(cd $(dirname $0); pwd)
displayIntro() {
cd $projectHome
echo
echo $banner
echo $(echo $banner | sed s/./=/g)
pwd
test -d .git || { echo "Project must be in a git repository."; exit; }
git restore dist/* &>/dev/null
git pull --ff-only
echo
}
installMessage() {
command=$1
echo
echo "Install missing program:"
echo " \$ $command"
echo
exit
}
findGroovyJar() {
groovyHome=$(cd $(dirname $(which groovy))/$(dirname $(readlink $(which groovy)))/../libexec; pwd)
groovyVersion=$(groovy --version | awk '{ print $3 }')
groovyJar=$groovyHome/lib/groovy-$groovyVersion.jar
}
setupTools() {
cd $projectHome
echo "[Tools]"
which java || installMessage "brew cask install java"
java --version
which groovy || installMessage "brew install groovy"
groovy --version
findGroovyJar
echo "Groovy JAR:"
ls $groovyJar
echo
}
compileDsi() {
cd $projectHome/src
echo "[Compiling]"
pwd
rm -rf ../build
groovyc -d ../build com/centerkey/dsi/*.groovy
ls ../build/com/centerkey/dsi/*.class
echo
}
bundleDsi() {
cd $projectHome/build
echo "[Bundling]"
pwd
rm ../dist/*
jar cfv ../dist/dsi.jar *
cp ../src/run.sh ../dist
ls -o ../dist
test -w ~/apps && mkdir -p ~/apps/dsi && cp -v ../dist/* ~/apps/dsi
echo
}
showDsiVersion() {
cd $projectHome
echo "[Versions]"
pwd
chmod +x dist/run.sh
ls -1o dist/*
dist/run.sh --version
echo
}
specRunner() {
# Usage:
# $ ~/apps/dsi/run.sh [SrcFolder] [Filename] [NewExt] [DestFolder]
cd $projectHome/spec/input
echo "[Specifications]"
pwd
ls -o
rm -rf ../output
$projectHome/dist/run.sh "." "index.bhtml" ".html" "../output/args"
$projectHome/dist/run.sh
mv *.html ../output
diff ../output/index.html ../output/args/index.html
echo
}
showResults() {
cd $projectHome/spec/output
echo "[Results]"
pwd
ls -o ../output
ls ../output/*.html | xargs open
echo
}
displayIntro
setupTools
compileDsi
bundleDsi
showDsiVersion
specRunner
showResults