-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ps1
36 lines (30 loc) · 922 Bytes
/
run.ps1
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
$ErrorActionPreference = "Stop"
function Check-Command($cmdname) {
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
}
$buildDir = "SmartCity-build";
$jarFile="backend\smartCity-2.0.jar"
if (!(Test-Path -Path $jarFile) -Or !(Test-Path -Path "frontend\index.html")) {
if (!(Test-Path -Path $buildDir)){
if (Test-Path -Path "scripts"){
Set-Location scripts
.\build.ps1;
Set-Location ..
}
else {
Write-Host "Missing files required to run app"
exit 1;
}
}
Set-Location $buildDir
}
$serve = "serve.cmd"
$arguments = "-n -s frontend";
Start-Process -NoNewWindow $serve $arguments
if (Check-Command -cmdname 'start') {
start http://localhost:5000
}
else {
Write-Host "You need to start localhost:5000 by yourself"
}
& "$Env:JAVA_HOME\bin\java.exe" -jar ".\backend\smartCity-2.0.jar"