From 89e20959bc050a964b62f3c965ab226392929ed6 Mon Sep 17 00:00:00 2001 From: aarunreddy <66240041+aarunreddy@users.noreply.github.com> Date: Fri, 18 Jul 2025 15:31:21 -0700 Subject: [PATCH] Update bootstrap Signed-off-by: aarunreddy <66240041+aarunreddy@users.noreply.github.com> --- script/bootstrap | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/script/bootstrap b/script/bootstrap index 64d5b971319..0cc7d932806 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -13,3 +13,44 @@ fi echo "==> Installing node dependencies…" npm install + +#python +import os +import subprocess +import sys +from pathlib import Path + +def run_command(command, cwd=None): + try: + print(f"==> Running: {' '.join(command)}") + subprocess.run(command, cwd=cwd, check=True) + except subprocess.CalledProcessError as e: + print(f"Error: {e}") + sys.exit(1) + +def main(): + # Move to project root (parent of script directory) + script_dir = Path(__file__).resolve().parent + project_root = script_dir.parent + os.chdir(project_root) + + # Check if SKIP_BUNDLER is set + skip_bundler = os.environ.get("SKIP_BUNDLER") + + if not skip_bundler: + print("==> Installing gem dependencies…") + try: + subprocess.run( + ["bundle", "check", "--path", "vendor/gems"], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + check=True + ) + except subprocess.CalledProcessError: + run_command(["bundle", "install", "--binstubs", "bin", "--path", "vendor/gems"]) + + print("==> Installing node dependencies…") + run_command(["npm", "install"]) + +if __name__ == "__main__": + main()