11#! /usr/bin/env bash
22
3- if [[ " $( uname -s) " != " Darwin" ]]; then
4- echo " Only macOS is currently supported."
5- exit 1
6- fi
7-
8- options=(" nodejs" " python" " golang" " rust" " java" )
9- binaries=(" node" " python" " go" " rustc" " javac" )
10-
11- declare -A has_asdf_plugin
12- has_asdf_plugin=([nodejs]=true [python]=true [golang]=true [rust]=true [java]=false)
13-
14- for i in " ${! options[@]} " ; do
15- choices[i]=" *"
16- done
17-
183menu () {
194 echo -e " \nWhich eval types would you like to support?\n"
205
@@ -31,6 +16,33 @@ menu() {
3116 echo
3217}
3318
19+ build_extension () {
20+ echo " Building the Roo Code extension..."
21+ cd ..
22+ mkdir -p bin
23+ npm run install-extension -- --silent --no-audit || exit 1
24+ npm run install-webview -- --silent --no-audit || exit 1
25+ npm run install-e2e -- --silent --no-audit || exit 1
26+ npx vsce package --out bin/roo-code-latest.vsix || exit 1
27+ code --install-extension bin/roo-code-latest.vsix || exit 1
28+ cd benchmark
29+ }
30+
31+ if [[ " $( uname -s) " != " Darwin" ]]; then
32+ echo " Only macOS is currently supported."
33+ exit 1
34+ fi
35+
36+ options=(" nodejs" " python" " golang" " rust" " java" )
37+ binaries=(" node" " python" " go" " rustc" " javac" )
38+
39+ declare -A has_asdf_plugin
40+ has_asdf_plugin=([nodejs]=true [python]=true [golang]=true [rust]=true [java]=false)
41+
42+ for i in " ${! options[@]} " ; do
43+ choices[i]=" *"
44+ done
45+
3446prompt=" Type 🔢 to select, 'a' for all, 'q' to quit, ⏎ to continue: "
3547
3648while menu && read -rp " $prompt " num && [[ " $num " ]]; do
@@ -136,6 +148,7 @@ if ! command -v asdf &>/dev/null; then
136148else
137149 ASDF_VERSION=$( asdf --version)
138150 echo " ✅ asdf is installed ($ASDF_VERSION )"
151+ . " $ASDF_PATH "
139152fi
140153
141154if ! command -v gh & > /dev/null; then
@@ -159,9 +172,7 @@ for i in "${!options[@]}"; do
159172 binary=" ${binaries[$i]} "
160173
161174 if [[ " ${has_asdf_plugin[$plugin]} " == " true" ]]; then
162- missing_plugin=$( ! asdf plugin list | grep -q " ^${plugin} $" )
163-
164- if [[ " $missing_plugin " == true ]] && ! command -v " ${binary} " & > /dev/null; then
175+ if ! asdf plugin list | grep -q " ^${plugin} $" && ! command -v " ${binary} " & > /dev/null; then
165176 echo " Installing ${plugin} asdf plugin..."
166177 asdf plugin add " ${plugin} " || exit 1
167178 echo " ✅ asdf ${plugin} plugin installed"
@@ -234,12 +245,22 @@ for i in "${!options[@]}"; do
234245 ;;
235246
236247 " java" )
237- if ! command -v javac & > /dev/null; then
248+ if ! command -v javac & > /dev/null || ! javac --version & > /dev/null; then
249+ echo " Installing Java..."
238250 brew install openjdk@17 || exit 1
239- JAVA_VERSION=$( java --version | head -n 1)
251+
252+ export PATH=" /opt/homebrew/opt/openjdk@17/bin:$PATH "
253+
254+ if [[ " $SHELL " == " /bin/zsh" ]] && ! grep -q ' export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' ~ /.zprofile; then
255+ echo ' export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~ /.zprofile
256+ elif [[ " $SHELL " == " /bin/bash" ]] && ! grep -q ' export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' ~ /.bash_profile; then
257+ echo ' export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~ /.bash_profile
258+ fi
259+
260+ JAVA_VERSION=$( javac --version | head -n 1)
240261 echo " ✅ Java is installed ($JAVA_VERSION )"
241262 else
242- JAVA_VERSION=$( java --version | head -n 1)
263+ JAVA_VERSION=$( javac --version | head -n 1)
243264 echo " ✅ Java is installed ($JAVA_VERSION )"
244265 fi
245266 ;;
257278
258279pnpm install --silent || exit 1
259280
260- if [[ ! -d " evals" ]]; then
281+ if [[ ! -d " ../../ evals" ]]; then
261282 if gh auth status & > /dev/null; then
262283 read -p " Would you like to be able to share eval results? (Y/n): " fork_evals
263284
264285 if [[ " $fork_evals " =~ ^[Yy]| ^$ ]]; then
265- gh repo fork cte/evals || exit 1
286+ gh repo fork cte/evals ../../evals || exit 1
266287 else
267- gh repo clone cte/evals || exit 1
288+ gh repo clone cte/evals ../../evals || exit 1
268289 fi
269290 else
270- git clone https://github.com/cte/evals.git || exit 1
291+ git clone https://github.com/cte/evals.git ../../evals || exit 1
271292 fi
272293fi
273294
@@ -282,12 +303,24 @@ if ! grep -q "OPENROUTER_API_KEY" .env; then
282303 echo " OPENROUTER_API_KEY=$openrouter_api_key " >> .env
283304fi
284305
306+ if ! command -v code & > /dev/null; then
307+ echo " Visual Studio Code cli is not installed"
308+ exit 1
309+ else
310+ VSCODE_VERSION=$( code --version | head -n 1)
311+ echo " ✅ Visual Studio Code is installed ($VSCODE_VERSION )"
312+ fi
313+
285314if [[ ! -s " ../bin/roo-code-latest.vsix" ]]; then
286- echo " Building the Roo Code extension..."
287- cd .. &&
288- npm run install-extension -- --silent --no-audit &&
289- npm run install-webview -- --silent --no-audit &&
290- npx vsce package --out bin/roo-code-latest.vsix || exit 1
315+ build_extension
316+ else
317+ read -p " Do you want to build a new version of the Roo Code extension? (y/N): " build_extension
318+
319+ if [[ " $build_extension " =~ ^[Yy]$ ]]; then
320+ build_extension
321+ code --install-extension bin/roo-code-latest.vsix || exit 1
322+ cd benchmark
323+ fi
291324fi
292325
293326echo -e " \n🤘 You're ready to rock and roll!\n"
0 commit comments