Skip to content

Commit 89e2095

Browse files
authored
Update bootstrap
Signed-off-by: aarunreddy <[email protected]>
1 parent 768cf2d commit 89e2095

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

script/bootstrap

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,44 @@ fi
1313

1414
echo "==> Installing node dependencies…"
1515
npm install
16+
17+
#python
18+
import os
19+
import subprocess
20+
import sys
21+
from pathlib import Path
22+
23+
def run_command(command, cwd=None):
24+
try:
25+
print(f"==> Running: {' '.join(command)}")
26+
subprocess.run(command, cwd=cwd, check=True)
27+
except subprocess.CalledProcessError as e:
28+
print(f"Error: {e}")
29+
sys.exit(1)
30+
31+
def main():
32+
# Move to project root (parent of script directory)
33+
script_dir = Path(__file__).resolve().parent
34+
project_root = script_dir.parent
35+
os.chdir(project_root)
36+
37+
# Check if SKIP_BUNDLER is set
38+
skip_bundler = os.environ.get("SKIP_BUNDLER")
39+
40+
if not skip_bundler:
41+
print("==> Installing gem dependencies…")
42+
try:
43+
subprocess.run(
44+
["bundle", "check", "--path", "vendor/gems"],
45+
stdout=subprocess.DEVNULL,
46+
stderr=subprocess.DEVNULL,
47+
check=True
48+
)
49+
except subprocess.CalledProcessError:
50+
run_command(["bundle", "install", "--binstubs", "bin", "--path", "vendor/gems"])
51+
52+
print("==> Installing node dependencies…")
53+
run_command(["npm", "install"])
54+
55+
if __name__ == "__main__":
56+
main()

0 commit comments

Comments
 (0)