This repository was archived by the owner on Feb 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfieldgit
More file actions
executable file
·56 lines (45 loc) · 1.32 KB
/
fieldgit
File metadata and controls
executable file
·56 lines (45 loc) · 1.32 KB
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
#!/usr/bin/env bash
BRANCH_NAME="master"
builApp() {
# run adb
[! -f "gradlew"] && echo "gradlew file not exists" && exit
# build and run the debug apk
./gradlew assembleDebug
}
installApp() {
adb install -r -g "$(find . -name "*.apk" -type f)"
adb shell am start -n org.bcss.collect.android/org.odk.collect.android.activities.SplashScreenActivity
}
askToTestRelease() {
read -p "Do you want to test realease (y/n)?" choice
case "$choice" in
y|Y ) echo "pulling master" ;;
n|N ) exit;;
* ) echo "invalid" && exit;;
esac
}
#check the branch name is provided in the command or not
if [ "$#" -ne 1 ]; then
RED='\033[1;33m'
NC='\033[0m' #no color
echo "${RED}Need to provide pullrequest(branch) name${NC}";
echo "https://github.com/fieldsight/fieldsight-mobile/pulls";
# confirm whether want to test default master
askToTestRelease
else BRANCH_NAME=$1
fi
echo "$BRANCH_NAME";
# get the current branch name
BRANCH=$(git branch)
# check the current branch is master or not
[[ $BRANCH != "master" ]] && git checkout master
#pull the branch from origin
git pull origin "$BRANCH_NAME"
if [ $? -eq 0 ]; then
echo "$1 is fetched successfully";
#checkout to the branch
git checkout "$BRANCH_NAME"
builApp && installApp
else
echo "Failed to pull, please check branch name"
fi