-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.sh
More file actions
174 lines (142 loc) · 3.27 KB
/
Copy pathcheck.sh
File metadata and controls
174 lines (142 loc) · 3.27 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env sh
# Code generated by shipbuilder init 1.21.0. DO NOT EDIT.
check_installed() {
installed=$(which "$1")
if [ -z "$installed" ]; then
echo "ERROR: $1 is not installed."
if [ "$CI" = "true" ]; then
exit 1
fi
echo "Do you want to install and continue? Y/N"
read install
install=$(echo "$install" | tr "[:lower:]" "[:upper:]")
if [ "$install" = "Y" -o "$install" = "YES" ]; then
sh -c "$2"
fi
export installed=$(which "$1")
if [ -z "$installed" ]; then
echo "ERROR: $1 is not installed."
echo "Install $1 using '$2'."
exit 1
fi
fi
}
brew_installed() {
if [ "$CI" != "true" ]; then
check_installed brew '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
brew=$installed
fi
}
brew_install() {
brew_installed
check_installed $1 "$brew install ${2:-$1}"
}
go_installed() {
brew_install go
go=$installed
}
go_install() {
go_installed
go get $1
go install $1
installed="go run $1"
}
node_installed() {
if [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
. /usr/local/opt/nvm/nvm.sh
nvm use --lts
fi
if [ -z "$installed" ]; then
installed=$(which node)
fi
if [ -z "$installed" ]; then
echo "ERROR: node is not installed."
if [ "$CI" = "true" ]; then
exit 1
fi
echo "Do you want to install and continue? Y/N"
read install
install=$(echo "$install" | tr "[:lower:]" "[:upper:]")
if [ "$install" = "Y" -o "$install" = "YES" ]; then
brew_installed
$brew install nvm
. /usr/local/opt/nvm/nvm.sh
nvm install --lts --latest-npm
nvm use --lts
installed=$(which node)
fi
if [ -z "$installed" ]; then
echo "ERROR: node is not installed."
echo "Install node using '$brew install nvm'."
exit 1
fi
fi
nvm=nvm
node="$installed"
}
npm_installed() {
node_installed
check_installed npm "$nvm install-latest-npm"
npm="$installed"
}
npm_install() {
npm_installed
check_installed "$1" "$npm install --location=global ${2:-$1}"
}
github_installed() {
brew_install gh
github="$installed"
}
git_installed() {
brew_install git
git="$installed"
}
docker_installed() {
brew_install docker "homebrew/cask/docker"
docker="$installed"
}
yq_installed() {
brew_install yq
yq="$installed"
}
jq_installed() {
brew_install jq
jq="$installed"
}
ncu_installed() {
npm_install ncu npm-check-updates
ncu="$installed"
}
swagger_cli_installed() {
npm_install swagger-cli "@apidevtools/swagger-cli"
swagger_cli="$installed"
}
protoc_installed() {
brew_install protoc protobuf
protoc="$installed"
}
protoc_gen_go_installed() {
go_install "google.golang.org/protobuf/cmd/protoc-gen-go"
protoc_gen_go="$installed"
}
protoc_gen_go_grpc_installed() {
go_install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
protoc_gen_go_grpc="$installed"
}
protoc_gen_nats_installed() {
go_install "go.ketch.com/tool/proto-nats/cmd/protoc-gen-nats"
protoc_gen_nats="$installed"
}
shipbuilder_installed() {
go_installed
shipbuilder="$go run go.ketch.com/tool/shipbuilder/cmd/shipbuilder"
}
mockery_installed() {
go_installed
mockery="$go run github.com/vektra/mockery/v2"
}
check() {
for i in $*; do
"${i}_installed"
done
}