From e7496bc08ef163796e71c6f056a7c1cd8dafa332 Mon Sep 17 00:00:00 2001 From: derNiklaas Date: Fri, 26 Jul 2019 02:54:41 +0200 Subject: [PATCH 1/3] Create install.bat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kinda ugly... but it works... 🤔 --- install.bat | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 install.bat diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..fe30427 --- /dev/null +++ b/install.bat @@ -0,0 +1,90 @@ +@echo off +set "MISSING_REQUIREMENT=false" + +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 "yarn=true" +CALL :check_optional_requirement yarn +IF "%MISSING_REQUIREMENT%"=="true" ( + SET "MISSING_REQUIREMENT=false" + CALL :check_optional_requirement npm + IF "%MISSING_REQUIREMENT%"=="true" ( + ECHO ! NPM or yarn is needed to set up webui + PAUSE + exit /b + ) ELSE ( + SET "yarn=false" + ) +) + +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 + +cd chatoverflow/ + +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 +) ELSE ( + ECHO * Found sbt. + sbt ";update;fetch;update" +) + +cd gui/ + +IF "%yarn%"=="true" ( + yarn +) ELSE ( + npm install +) + +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 From 1d07d170f297d2d199f48b95ec437c0c7a7480bf Mon Sep 17 00:00:00 2001 From: derNiklaas Date: Fri, 26 Jul 2019 03:31:40 +0200 Subject: [PATCH 2/3] Update install.bat --- install.bat | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/install.bat b/install.bat index fe30427..8b55ade 100644 --- a/install.bat +++ b/install.bat @@ -11,20 +11,30 @@ IF "%MISSING_REQUIREMENT%"=="true" ( ECHO * All requirements are installed ) +SET "npm=true" SET "yarn=true" CALL :check_optional_requirement yarn IF "%MISSING_REQUIREMENT%"=="true" ( - SET "MISSING_REQUIREMENT=false" - CALL :check_optional_requirement npm - IF "%MISSING_REQUIREMENT%"=="true" ( - ECHO ! NPM or yarn is needed to set up webui - PAUSE - exit /b - ) ELSE ( - SET "yarn=false" - ) + 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 @@ -35,9 +45,9 @@ cd chatoverflow/ 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 + 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 ) ELSE ( ECHO * Found sbt. sbt ";update;fetch;update" @@ -45,13 +55,15 @@ IF "%MISSING_REQUIREMENT%"=="true" ( cd gui/ +ECHO * Installing GUI (this may take a while...) + IF "%yarn%"=="true" ( yarn ) ELSE ( npm install ) -echo * Success! You can now open the project in IntelliJ (or whatever IDE you prefer) +ECHO * Success! You can now open the project in IntelliJ (or whatever IDE you prefer) PAUSE From 5186a82ce58d2c924fd8114a1b5a6a2b25528a5c Mon Sep 17 00:00:00 2001 From: derNiklaas Date: Fri, 26 Jul 2019 14:17:00 +0200 Subject: [PATCH 3/3] This should fix all of our problems. (atleast for me) --- install.bat | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/install.bat b/install.bat index 8b55ade..d613830 100644 --- a/install.bat +++ b/install.bat @@ -34,7 +34,6 @@ IF "%npm%"=="false" ( ) ) - 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 @@ -50,7 +49,7 @@ IF "%MISSING_REQUIREMENT%"=="true" ( ECHO ! Or follow the guide at https://github.com/codeoverflow-org/chatoverflow/wiki/Installation ) ELSE ( ECHO * Found sbt. - sbt ";update;fetch;update" + CALL sbt ";update;fetch;update" ) cd gui/ @@ -58,14 +57,14 @@ cd gui/ ECHO * Installing GUI (this may take a while...) IF "%yarn%"=="true" ( - yarn + ECHO * Using yarn... + CALL yarn ) ELSE ( - npm install + ECHO * Using npm... + CALL npm install ) ECHO * Success! You can now open the project in IntelliJ (or whatever IDE you prefer) - - PAUSE exit /b