-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtestit
More file actions
executable file
·35 lines (31 loc) · 761 Bytes
/
testit
File metadata and controls
executable file
·35 lines (31 loc) · 761 Bytes
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
#!/bin/bash
run_in_testit_path() {
if [ `uname` == Darwin ]; then
READLINK=greadlink
else
READLINK=readlink
fi
path=`dirname "$($READLINK -f "${BASH_SOURCE%/*}/testit")"`
cd $path > /dev/null
eval "$1"
cd - > /dev/null
}
trim() {
local trimmed="$1"
while [[ $trimmed == ' '* ]]; do
trimmed="${trimmed## }"
done
while [[ $trimmed == *' ' ]]; do
trimmed="${trimmed%% }"
done
echo "$trimmed"
}
if [ $# -ne 0 ]
then
target=`realpath "${@:$#}"`
all_but_last_args=${*%${!#}}
args="$(trim " $target $all_but_last_args ")"
run_in_testit_path "./gradlew run -q --console=plain --args=\"${args}\""
else
run_in_testit_path "./gradlew run -q --console=plain"
fi