-
Notifications
You must be signed in to change notification settings - Fork 1
/
run
executable file
·77 lines (68 loc) · 1.88 KB
/
run
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
#!/usr/bin/env bash
install_cmd() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
pip install GitPython
python3 setup.py
nvm install v18.14.0
nvm use v18.14.0
npm install
rm -rf build
}
build_cmd() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install v18.14.0 > /dev/null 2>&1
nvm use v18.14.0 > /dev/null
npm run compile
}
test_cmd() {
export LOG_FILE=log_file.txt
export LOG_LEVEL=0
export GITHUB_TOKEN=none
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install v18.14.0 > /dev/null 2>&1
nvm use v18.14.0 > /dev/null
python3 run_test.py
}
run_cmd() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install v18.14.0 > /dev/null 2>&1
nvm use v18.14.0 > /dev/null
node build/src/index.js "$1"
}
case "$1" in
install)
install_cmd && exit 0
echo "install command failed!"
;;
build)
build_cmd && exit 0
echo "build command failed!"
;;
test)
test_cmd && exit 0
echo "test command failed!"
;;
*)
if test -f "$1"; then
run_cmd $1 && exit 0
echo "using url file failed!"
else
if test -d "$1"; then
echo "$1 is a directory, not a file!"
else
echo "$1 does not exist!"
fi
fi
;;
esac
# if error: exit with code 1
exit 1