Merge branch 'master' of https://mhsl.eu/gitea/TheAdversary/PeerReview
This commit is contained in:
@@ -74,3 +74,6 @@ Dockerfile:
|
|||||||
|
|
||||||
TheAdversary (Linux) / TheAdversary (Windows):
|
TheAdversary (Linux) / TheAdversary (Windows):
|
||||||
Das kompilierte Backend aus dem backend/ Ordner.
|
Das kompilierte Backend aus dem backend/ Ordner.
|
||||||
|
|
||||||
|
build:
|
||||||
|
Falls du unter Linux bist kannst du mit dem /build/build.sh kannst du das backend from source builden.
|
||||||
|
|||||||
5
build/.gitignore
vendored
Normal file
5
build/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.env
|
||||||
|
out/
|
||||||
|
backend/
|
||||||
|
frontend/
|
||||||
|
TheAdversary/
|
||||||
53
build/build.sh
Normal file
53
build/build.sh
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
src_dir=${SRCDIR:=./TheAdversary}
|
||||||
|
out_dir=${OUTDIR:=./out}
|
||||||
|
|
||||||
|
local=false
|
||||||
|
|
||||||
|
while getopts :l opts; do
|
||||||
|
case $opts in
|
||||||
|
l) local=true;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
pwd=$PWD
|
||||||
|
|
||||||
|
if ! $local; then
|
||||||
|
read -p "Git username: " username
|
||||||
|
read -sp "$username git password: " password
|
||||||
|
|
||||||
|
for name in backend frontend; do
|
||||||
|
path=$src_dir/$name
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
cd $path
|
||||||
|
git pull
|
||||||
|
cd $pwd
|
||||||
|
else
|
||||||
|
git clone https://$username:$password@mhsl.eu/gitea/TheAdversary/$name.git $path
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$out_dir" ]; then
|
||||||
|
mkdir $out_dir
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo "INFO: Building sass files"
|
||||||
|
# for f in $(ls $src_dir/frontend/sass/*.sass); do
|
||||||
|
# sass --update $f $src_dir/frontend/sass/$(basename $f .sass).css
|
||||||
|
# done
|
||||||
|
|
||||||
|
echo "INFO: Building backend"
|
||||||
|
cd $src_dir/backend
|
||||||
|
go build . TheAdversary
|
||||||
|
cd $pwd
|
||||||
|
|
||||||
|
echo "INFO: Copying output to output directory"
|
||||||
|
for f in $src_dir/backend/{TheAdversary,database.sqlite3,.env}; do
|
||||||
|
cp -rf $f $out_dir
|
||||||
|
done
|
||||||
|
|
||||||
|
for f in $src_dir/frontend; do
|
||||||
|
cp -rf $f $out_dir/frontend/
|
||||||
|
done
|
||||||
63
build/watch.sh
Normal file
63
build/watch.sh
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
init() {
|
||||||
|
for dir in frontend backend out; do
|
||||||
|
if [ ! -d $dir ]; then
|
||||||
|
mkdir $dir
|
||||||
|
if [ $dir != "out" ]; then
|
||||||
|
echo Cloning $dir
|
||||||
|
git clone https://mhsl.eu/gitea/TheAdversary/$dir.git
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
pwd=$PWD
|
||||||
|
cd out/backend/
|
||||||
|
go build .
|
||||||
|
cp -rf TheAdversary database.sqlite3 ../
|
||||||
|
if [ ! -f ../../.env ]; then
|
||||||
|
cp -rf .env ../
|
||||||
|
else
|
||||||
|
cp ../../.env ../
|
||||||
|
fi
|
||||||
|
cd $pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
pwd=$PWD
|
||||||
|
cd out/
|
||||||
|
./TheAdversary
|
||||||
|
cd $pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
kill $(pidof TheAdversary)
|
||||||
|
}
|
||||||
|
|
||||||
|
process() {
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
cp -rf frontend/ backend/ out/
|
||||||
|
build
|
||||||
|
echo "Restarting"
|
||||||
|
stop
|
||||||
|
start &
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
init
|
||||||
|
cp -rf frontend/ backend/ out/
|
||||||
|
build
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
start &
|
||||||
|
fi
|
||||||
|
|
||||||
|
while inotifywait -r -e modify frontend/ backend/; do
|
||||||
|
if [ -d /proc/$! ]; then
|
||||||
|
kill $!
|
||||||
|
fi
|
||||||
|
process &
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
Reference in New Issue
Block a user