-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·87 lines (71 loc) · 1.42 KB
/
init.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
#!/usr/bin/env bash
DIR=$(dirname $(realpath "$0"))
cd $DIR
direnv allow . && eval "$(direnv export $SHELL)"
set -ex
GIT="${GIT:-git@github.com:user-tax}"
GIT_CONF="${GIT_CONF:-git@github.com:user-tax/conf.git}"
if ! [ -x "$(command -v cargo)" ]; then
echo "need install rust"
exit
fi
if ! [ -x "$(command -v openresty)" ]; then
if [ -x "$(command -v brew)" ]; then
brew install openresty/brew/openresty
else
echo "not install openresty"
fi
fi
cd $DIR
if [ ! -d "conf" ]; then
git clone --recursive --depth=1 $GIT_CONF conf
fi
cd conf
direnv allow
cd $DIR
cargo_install() {
if ! [ -x "$(command -v $1)" ]; then
cargo install --locked ${2:-$1}
fi
}
cargo_install watchexec watchexec-cli
cargo_install fd
cargo_install sd
cargo_install rtx rtx-cli
eval "$(rtx activate --quiet $(basename bash))"
rtx plugin add nodejs
rtx install
if ! [ -x "$(command -v bun)" ]; then
PATH_add $HOME/.bun/bin
if ! [ -x "$(command -v bun)" ]; then
curl https://bun.sh/install | bash
fi
fi
init() {
if [ ! -d "$1" ]; then
git clone --recursive --depth=1 $GIT/$1.git
if [ -f "$1/.envrc" ]; then
cd $1
direnv allow .
cd ..
fi
fi
}
init doc
init pkg
init styl
init ui
init api
init site
init ru
if [ ! -d "ru/target" ]; then
direnv exec $DIR/ru ./ru/build.sh
fi
init docker_dev
mkdir -p lib
cd lib
init utax
cd $DIR/pkg
direnv exec . ./init.coffee
direnv exec . ./i18n.coffee
cd $DIR