forked from data-players/deploy-archipelago2-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
56 lines (48 loc) · 1.44 KB
/
dev.sh
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
#!/bin/bash
function init () {
rm -rf dev
git clone https://github.com/assemblee-virtuelle/archipelago dev
update
}
function update () {
. ./.env.local
if [ -z $ARCHIPELAGO_VERSION ]
then
echo "You need to define variable ARCHIPELAGO_VERSION to the working commit or tag in your .env.local file"
exit 1
fi
echo "Archipelago version $ARCHIPELAGO_VERSION"
cd dev
git reset --hard HEAD
git clean -fd
git fetch
git checkout --detach $ARCHIPELAGO_VERSION
cd ..
git stash --include-untracked
cp -R addOn/* dev
(cd dev && git add . && git commit -am "Local changes")
git stash pop
cp -R addOn/* dev
sed 's/fuseki/localhost/g' < .env.local > dev/frontend/.env.local
sed 's/fuseki/localhost/g' < .env.local > dev/middleware/.env.local
(cd dev/frontend && yarn)
(cd dev/middleware && yarn)
}
function sync () {
cd dev
git add --all
git status --porcelain --no-renames | (
while read line ; do
trimmed=$(echo $line | sed 's/^ //')
gitstatus=$(echo $trimmed | cut -d" " -f1)
filepath=$(echo $trimmed | cut -d" " -f2- | sed 's/^ //')
case "$gitstatus" in
'A') mkdir -p ../addOn/$(dirname $filepath) && cp $filepath ../addOn/$filepath ; ;;
'M') mkdir -p ../addOn/$(dirname $filepath) && cp $filepath ../addOn/$filepath ; ;;
'D') rm -f ../addOn/$filepath ; ;;
*) echo "Error: Git status $gitstatus not handled for file $filepath !"
esac
done
)
cd ..
}