-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·35 lines (35 loc) · 915 Bytes
/
run
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
#!/usr/bin/env bash
############################################
# Dan Nielsen
# Build and run the app
# Use "run debug" for debug mode
############################################
# Create api/Version.h
# Set APP_DEBUG if "run debug" was called
make version
if [[ "$1" == "debug" ]]; then
echo \#define APP_DEBUG >> api/Version.h
fi
# Get version string from api/Version.h
ver=$(grep "APP_VERSION" api/Version.h)
tmp=($ver)
ver=${tmp[2]}
echo $ver
# Set version number in web/package.json
node > tmp.json <<EOF
var data = require('./web/package.json');
data.version = $ver;
console.log(JSON.stringify(data,null,2));
EOF
mv tmp.json web/package.json
# Create web/public/version.js
# Set DEBUG if "run debug" was called
echo "const VERSION=$ver;" > web/public/version.js
if [[ "$1" == "debug" ]]; then
echo "const DEBUG=1;" >> web/public/version.js
fi
# Make
make $1
# Start web server
echo Running $1
npm start