Removed build
This commit is contained in:
5
build/.gitignore
vendored
5
build/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
.env
|
||||
out/
|
||||
backend/
|
||||
frontend/
|
||||
TheAdversary/
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,63 +0,0 @@
|
||||
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