forked from asciimoo/omnom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.sh
executable file
·90 lines (70 loc) · 1.49 KB
/
manage.sh
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
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
OMNOM_BASE_URL="http://127.0.0.1:7332/"
CONFIG_PATH="$BASE_DIR/tests/test_config.yml"
ACTION="$1"
[ -z "$ACTION" ] || shift
cd -- "$BASE_DIR"
set -e
help() {
[ -z "$1" ] || printf 'Error: %s\n' "$1"
echo "Omnom manage.sh help
Commands
========
help - Display help
Dependencies
------------------
install_js_deps - Install or install frontend dependencies (required only for development)
install_test_deps - Install or install test dependencies
Tests
-----
run_unit_tests - Run unit tests
run_e2e_tests - Run browser tests
start_test_server - Launch test server
Build
-----
build_css - Build css files
build_addon - Build addon
========
Execute 'go run omnom.go' or 'go build && ./omnom' for application related actions
"
[ -z "$1" ] && exit 0 || exit 1
}
install_js_deps() {
cd sass
npm i --unsafe-perm -g
cd ..
cd ext
npm install cross-env
npm i
cd ..
}
install_test_deps() {
cd tests/e2e/extension
npm i
cd "$BASE_DIR"
}
run_unit_tests() {
go test ./...
}
run_e2e_tests() {
cd tests/e2e/extension
node test.js
cd "$BASE_DIR"
}
start_test_server() {
go run omnom.go --config "$CONFIG_PATH" listen
}
build_css() {
cd sass
npm run build:css
cd ..
}
build_addon() {
cd ext
npm run build
cd ..
}
[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
&& help "action not found" \
|| "$ACTION" "$@"