-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_tools.sh
120 lines (106 loc) · 2.77 KB
/
setup_tools.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/utils.sh"
enable_strict_mode
usage() {
echo "Usage: $0 [--all] [--nodejs] [--deno] [--go] [--python] [--rust] [--fish] [--help]"
echo "Options:"
echo " --all Install all tools"
echo " --nodejs Install Node.js"
echo " --deno Install Deno"
echo " --go Install Go"
echo " --python Install Python"
echo " --rust Install Rust"
echo " --fish Install Fish shell"
echo " --help Display this help message"
exit 1
}
INSTALL_NODEJS=false
INSTALL_DENO=false
INSTALL_GO=false
INSTALL_PYTHON=false
INSTALL_RUST=false
INSTALL_FISH=false
if [ $# -eq 0 ]; then
usage
else
for arg in "$@"; do
case $arg in
--nodejs)
INSTALL_NODEJS=true
;;
--deno)
INSTALL_DENO=true
;;
--go)
INSTALL_GO=true
;;
--python)
INSTALL_PYTHON=true
;;
--rust)
INSTALL_RUST=true
;;
--fish)
INSTALL_FISH=true
;;
--all)
INSTALL_NODEJS=true
INSTALL_DENO=true
INSTALL_GO=true
INSTALL_PYTHON=true
INSTALL_RUST=true
INSTALL_FISH=true
;;
*)
usage
;;
esac
done
fi
echo "Installing dependencies..."
check_success brew install curl git asdf
# Node
if [ "$INSTALL_NODEJS" = true ]; then
echo "Setting up Node.js..."
check_success asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
check_success asdf nodejs update-nodebuild
NODE_LTS=$(asdf nodejs resolve lts --latest-available)
check_success asdf install nodejs "$NODE_LTS"
check_success asdf global nodejs "$NODE_LTS"
check_success corepack enable
check_success corepack prepare pnpm@latest --activate
check_success asdf reshim nodejs
fi
# Deno
if [ "$INSTALL_DENO" = true ]; then
echo "Setting up Deno..."
check_success asdf plugin-add deno https://github.com/asdf-community/asdf-deno.git
check_success asdf install deno latest
check_success asdf global deno latest
fi
# Go
if [ "$INSTALL_GO" = true ]; then
echo "Setting up Go..."
check_success asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
check_success asdf install golang latest
check_success asdf global golang latest
fi
# Python
if [ "$INSTALL_PYTHON" = true ]; then
echo "Setting up Python..."
check_success asdf plugin add python
check_success asdf install python latest
check_success asdf global python latest
fi
# Rust
if [ "$INSTALL_RUST" = true ]; then
echo "Setting up Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y || error_exit "Failed to install Rust"
fi
# Fish
if [ "$INSTALL_FISH" = true ]; then
echo "Setting up Fish shell..."
check_success brew install fish
fi
echo "Selected tools installed successfully"