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

Commit 7e37349

Browse files
authored
Merge pull request #4 from derNiklaas/patch-1
Create install.bat
2 parents 8e3da71 + 5186a82 commit 7e37349

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

install.bat

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

0 commit comments

Comments
 (0)