Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit e7496bc

Browse files
authored
Create install.bat
kinda ugly... but it works... 🤔
1 parent 8e3da71 commit e7496bc

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

install.bat

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
@echo off
2+
set "MISSING_REQUIREMENT=false"
3+
4+
CALL :check_requirement git Git
5+
6+
IF "%MISSING_REQUIREMENT%"=="true" (
7+
ECHO ! Git not found. Git is required to clone individual subrepos.
8+
PAUSE
9+
exit /b
10+
) ELSE (
11+
ECHO * All requirements are installed
12+
)
13+
14+
SET "yarn=true"
15+
CALL :check_optional_requirement yarn
16+
IF "%MISSING_REQUIREMENT%"=="true" (
17+
SET "MISSING_REQUIREMENT=false"
18+
CALL :check_optional_requirement npm
19+
IF "%MISSING_REQUIREMENT%"=="true" (
20+
ECHO ! NPM or yarn is needed to set up webui
21+
PAUSE
22+
exit /b
23+
) ELSE (
24+
SET "yarn=false"
25+
)
26+
)
27+
28+
CALL :check_folder chatoverflow https://github.com/codeoverflow-org/chatoverflow chatoverflow
29+
CALL :check_folder chatoverflow/api https://github.com/codeoverflow-org/chatoverflow-api chatoverflow/api
30+
CALL :check_folder chatoverflow/gui https://github.com/codeoverflow-org/chatoverflow-gui chatoverflow/gui
31+
CALL :check_folder chatoverflow/plugins-public https://github.com/codeoverflow-org/chatoverflow-plugins chatoverflow/plugins-public
32+
33+
cd chatoverflow/
34+
35+
SET "MISSING_REQUIREMENT=false"
36+
CALL :check_optional_requirement sbt
37+
IF "%MISSING_REQUIREMENT%"=="true" (
38+
echo ! We would love to set the project up for you, but it seems like you don't have sbt installed.
39+
echo ! Please install sbt and execute $ sbt ';update;fetch;update'
40+
echo ! Or follow the guide at https://github.com/codeoverflow-org/chatoverflow/wiki/Installation
41+
) ELSE (
42+
ECHO * Found sbt.
43+
sbt ";update;fetch;update"
44+
)
45+
46+
cd gui/
47+
48+
IF "%yarn%"=="true" (
49+
yarn
50+
) ELSE (
51+
npm install
52+
)
53+
54+
echo * Success! You can now open the project in IntelliJ (or whatever IDE you prefer)
55+
56+
57+
PAUSE
58+
exit /b
59+
60+
:check_folder
61+
62+
IF EXIST %1/NUL (
63+
ECHO * Folder "%1" already exists
64+
) ELSE (
65+
ECHO * Folder "%1" does NOT exist.
66+
git clone %2 %3
67+
)
68+
69+
exit /b
70+
71+
:check_requirement
72+
SET "MISSING_REQUIREMENT=true"
73+
WHERE %1 > NUL 2>&1 && SET "MISSING_REQUIREMENT=false"
74+
75+
IF "%MISSING_REQUIREMENT%"=="true" (
76+
ECHO * Download and install %2
77+
SET "MISSING_REQUIREMENT=true"
78+
)
79+
80+
exit /b
81+
82+
:check_optional_requirement
83+
SET "MISSING_REQUIREMENT=true"
84+
WHERE %1 > NUL 2>&1 && SET "MISSING_REQUIREMENT=false"
85+
86+
IF "%MISSING_REQUIREMENT%"=="true" (
87+
SET "MISSING_REQUIREMENT=true"
88+
)
89+
90+
exit /b

0 commit comments

Comments
 (0)