This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.bat
140 lines (113 loc) · 3.28 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@echo off
set "MISSING_REQUIREMENT=false"
set "DEV=false"
set "BUILD=false"
CALL :parse_options %*
CALL :check_requirement git Git
IF "%MISSING_REQUIREMENT%"=="true" (
ECHO ! Git not found. Git is required to clone individual subrepos.
PAUSE
exit /b
) ELSE (
ECHO * All requirements are installed
)
SET "npm=true"
SET "yarn=true"
SET "sbt=true"
CALL :check_optional_requirement yarn
IF "%MISSING_REQUIREMENT%"=="true" (
ECHO * Note: Yarn is not installed.
SET "yarn=false"
)
set "MISSING_REQUIREMENT=false"
CALL :check_optional_requirement npm
IF "%MISSING_REQUIREMENT%"=="true" (
ECHO * Note: npm is not installed.
SET "npm=false"
)
IF "%npm%"=="false" (
IF "%yarn%"=="false" (
ECHO ! NPM or yarn is needed to set up webui
PAUSE
exit /b
)
)
CALL :check_folder chatoverflow https://github.com/codeoverflow-org/chatoverflow chatoverflow
CALL :check_folder chatoverflow/api https://github.com/codeoverflow-org/chatoverflow-api chatoverflow/api
CALL :check_folder chatoverflow/gui https://github.com/codeoverflow-org/chatoverflow-gui chatoverflow/gui
CALL :check_folder chatoverflow/plugins-public https://github.com/codeoverflow-org/chatoverflow-plugins chatoverflow/plugins-public
CALL :check_folder chatoverflow/launcher https://github.com/codeoverflow-org/chatoverflow-launcher chatoverflow/launcher
cd chatoverflow/
IF "%DEV%"=="true" (
ECHO * Switching to develop branch
CALL git checkout -f develop
CALL git -C api checkout -f develop
CALL git -C gui checkout -f develop
CALL git -C plugins-public checkout -f develop
CALL git -C launcher checkout develop
)
SET "MISSING_REQUIREMENT=false"
CALL :check_optional_requirement sbt
IF "%MISSING_REQUIREMENT%"=="true" (
ECHO ! We would love to set the project up for you, but it seems like you don't have sbt installed.
ECHO ! Please install sbt and execute $ sbt ';update;fetch;update'
ECHO ! Or follow the guide at https://github.com/codeoverflow-org/chatoverflow/wiki/Installation
SET "sbt=false"
) ELSE (
ECHO * Found sbt.
CALL sbt ";update;fetch;update"
)
cd gui/
ECHO * Installing GUI (this may take a while...)
IF "%yarn%"=="true" (
ECHO * Using yarn...
CALL yarn
) ELSE (
ECHO * Using npm...
CALL npm install
)
cd ..
IF "%BUILD%"=="true" (
IF "%sbt%"=="true" (
ECHO * Building Chatoverflow with Advanced Build Configuration
CALL sbt ";clean;compile;gui;fetch;reload;version;package;copy"
)
)
ECHO * Success! You can now open the project in IntelliJ (or whatever IDE you prefer)
PAUSE
exit /b
:check_folder
IF EXIST %1/NUL (
ECHO * Folder "%1" already exists
) ELSE (
ECHO * Folder "%1" does NOT exist.
git clone %2 %3
)
exit /b
:check_requirement
SET "MISSING_REQUIREMENT=true"
WHERE %1 > NUL 2>&1 && SET "MISSING_REQUIREMENT=false"
IF "%MISSING_REQUIREMENT%"=="true" (
ECHO * Download and install %2
SET "MISSING_REQUIREMENT=true"
)
exit /b
:check_optional_requirement
SET "MISSING_REQUIREMENT=true"
WHERE %1 > NUL 2>&1 && SET "MISSING_REQUIREMENT=false"
IF "%MISSING_REQUIREMENT%"=="true" (
SET "MISSING_REQUIREMENT=true"
)
exit /b
:parse_options
IF NOT "%1"=="" (
IF "%1"=="--dev" (
SET "DEV=true"
)
IF "%1"=="--build" (
SET "BUILD=true"
)
SHIFT
GOTO :parse_options
)
exit /b