-
Notifications
You must be signed in to change notification settings - Fork 15
/
runner
executable file
·36 lines (28 loc) · 1003 Bytes
/
runner
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
#!/usr/bin/env bash
## Expand aliases
shopt -s expand_aliases
## Returns an absolute path to file
alias runner_realpath="readlink -f"
## Fallbacks for GNU readlink
## Detecting GNU coreutils http://stackoverflow.com/a/8748344/319952
if ! readlink --version >/dev/null 2>&1; then
if hash greadlink 2>/dev/null; then
alias runner_realpath="greadlink -f"
else
alias runner_realpath="perl -MCwd -le 'print Cwd::abs_path(shift)'"
fi
fi
if [[ "${FUNCNAME[0]}" == source ]]; then
echo "Can't source the 'runner' executable. Instead, source 'src/runner.sh' directly."
exit 1
fi
## Resolve the absolute path to the source folder
runner_src_dir="$(dirname "$(runner_realpath "${0}")")/../src"
## Resolve resolved path to remove the '../' part
runner_src_dir="$(runner_realpath "${runner_src_dir}")"
## Include core files
# shellcheck source=src/runner.sh
source "${runner_src_dir}/runner.sh"
## Include CLI specific files
# shellcheck source=src/cli.sh
source "${runner_src_dir}/cli.sh"