-
Notifications
You must be signed in to change notification settings - Fork 17
/
loadModules
executable file
·79 lines (62 loc) · 1.85 KB
/
loadModules
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
#!/bin/bash
# ignore changes to these two files
git update-index --skip-worktree modules.txt
git update-index --skip-worktree settings.gradle
git update-index --skip-worktree .idea/runConfigurations/CLI_Main.xml
git update-index --skip-worktree .idea/compiler.xml
git update-index --skip-worktree .idea/vcs.xml
prefix=`./utils/project-prefix`
url=https://bitbucket.org/vrai-labs
if [[ $1 = "--ssh" ]]
then
[email protected]:vrai-labs
fi
if [ $prefix == "supertokens" ]; then
url=https://github.com/
if [[ $1 = "--ssh" ]]; then
fi
fi
# clear settings.gradle
> settings.gradle
echo "include 'supertokens-core:cli'" >> settings.gradle
echo "include 'supertokens-core:downloader'" >> settings.gradle
echo "include 'supertokens-core:ee'" >> settings.gradle
# add new line char at the end in case it's not there for looping
echo >> modules.txt
# looping
cat modules.txt | while read line
do
if [[ ! -z "$line" ]] && [[ $line != //* ]]
then
while IFS=',' read -ra ADDR; do
counter=0
user_name=supertokens
for i in "${ADDR[@]}"; do
if [ $counter == 0 ];
then
repo_name="$i"
else
if [ $counter == 1 ];
then
branch="$i"
else
user_name="$i"
fi
fi
counter=$(($counter+1))
done
done <<< "$line"
# we now have $repo_name and $branch and $user_name if exists for that repo
if [[ $repo_name != "sqlite-plugin" ]]
then
git clone --branch $branch $url$user_name/$prefix-$repo_name.git
cp ./utils/pre-commit $prefix-$repo_name/.git/hooks/
cp ./utils/addDevTag $prefix-$repo_name/addDevTag
cp ./utils/addReleaseTag $prefix-$repo_name/addReleaseTag
echo "include '$prefix-$repo_name'" >> settings.gradle
fi
fi
done
# remove new line char from end for next use of this script
printf %s "$(< modules.txt)" > modules.txt