This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgo
executable file
·137 lines (119 loc) · 2.82 KB
/
go
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
SCRIPT_DIR=$(dirname $0)
set -e
goal_test-frontend() {
echo "Start frontend tests"
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm run lint
npm test
popd > /dev/null
}
goal_test-backend() {
echo "Start backend tests"
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein test
popd > /dev/null
}
goal_test() {
goal_test-frontend
goal_test-backend
}
goal_serve-backend() {
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein run
popd > /dev/null
}
goal_serve-ui() {
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm start
popd > /dev/null
}
goal_compile-ui() {
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm run compile
popd > /dev/null
}
goal_run() {
NAMESPACE="lambdaui.example.simple-pipeline"
pushd ${SCRIPT_DIR}/example-pipeline > /dev/null
./lein run -m ${NAMESPACE}
popd > /dev/null
}
goal_push() {
goal_test
git push
}
goal_setup() {
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm install lodash
npm install
popd > /dev/null
}
goal_clean() {
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein clean
rm -rf resources/public-lambdaui
popd > /dev/null
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm run clean
popd > /dev/null
}
goal_jar() {
echo 'Compiling frontend'
pushd ${SCRIPT_DIR}/frontend > /dev/null
npm run compile
popd > /dev/null
if [ ! -e ${SCRIPT_DIR}/backend/resources/public-lambdaui ]; then
mkdir -p ${SCRIPT_DIR}/backend/resources/public-lambdaui
mkdir -p ${SCRIPT_DIR}/backend/resources/public-lambdaui/thirdparty/fontawesome
fi
echo 'Copying frontend assets to backend'
cp frontend/target/* backend/resources/public-lambdaui
cp -R frontend/src/thirdparty/fontawesome backend/resources/public-lambdaui/thirdparty
echo 'Compiling backend'
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein jar
popd > /dev/null
}
goal_deploy-clojars(){
echo "Deploying snapshot to clojars..."
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein deploy clojars
popd > /dev/null
}
goal_deploy() {
echo 'Deploying'
goal_clean
goal_test
goal_jar
goal_deploy-clojars
}
goal_release() {
echo 'Releasing'
goal_clean
goal_test
goal_jar
pushd ${SCRIPT_DIR}/backend > /dev/null
./lein release clojars
popd > /dev/null
git push
git push --tags
}
if type -t "goal_$1" &>/dev/null; then
goal_$1 ${@:2}
else
echo "usage: $0 <goal>
goal:
All:
push -- run all tests and push current state
setup -- set up environment
clean -- clean all generated files
test -- run tests for backend and frontend
Frontend:
compile-ui -- Compiles UI into resources/ui/public-lambdaui
serve-ui -- Serves UI on port 8080. Watches frontend and recompiles with webpack if necessary.
serve-backend -- Serves the backend-for-frontend on port 4444
Example Pipeline:
run -- run example pipeline"
exit 1
fi