Last active
April 1, 2020 12:58
-
-
Save PolarbearDK/9d2a12507fd65d72a9000e7714060d38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$GitRoot = "c:\Development" | |
Write-Host "Hello master." -ForegroundColor Magenta | |
function cd-apex { set-location "$GitRoot\Schultz.Apex" } | |
function cd-apexsearch { set-location "$GitRoot\Schultz.Apex\src\fasit-search\Fasit.Search.FrontendService\ClientApp" } | |
function cd-apexui { set-location "$GitRoot\Schultz.Apex\src\fasit-ui\shared-components" } | |
function cd-fasit { set-location "$GitRoot\Schultz.Fasit" } | |
function cd-fasit-jobcenter { set-location "$GitRoot\Schultz.Apex\src\clients\jobcenter-desktop\jobcenter-desktop-frontend" } | |
function start-docker-service { | |
$service = get-service com.docker.service | |
if ($service.Status -eq "Stopped") { | |
$service.Start() | |
Start-Sleep -Seconds 5 | |
} | |
while ($service.Status -eq "Starting") { | |
Write-Output "Waiting for docker service to start" | |
Start-Sleep -Seconds 5 | |
$service = get-service com.docker.service | |
} | |
if ($service.Status -eq "Running") { | |
return $true | |
} | |
return $false | |
} | |
function test-docker-service { | |
$output = & docker info 2>&1 | |
while ($LASTEXITCODE -eq 1) { | |
Write-Output 'Waiting for docker service to respond' | |
Start-Sleep -Seconds 5 | |
$output = & docker info 2>&1 | |
} | |
} | |
function EnsureDockerIsRunning { | |
$result = start-docker-service | |
if ($result -eq $true) { | |
test-docker-service | |
} | |
} | |
function Start-ApexInfrastructure { | |
EnsureDockerIsRunning | |
cd-apex | |
# .\local-profiles\start-fasit-infrastructure.ps1 | |
} | |
function Start-Dev { | |
Param( | |
[Parameter(Mandatory = $True)] | |
[ValidateSet("jdc", "jdc-only", "backend", "search", "search-ui", "apex-all", "apex-backend")] | |
[string]$environment | |
) | |
switch ($environment) { | |
"jdc" { | |
& $GitRoot\Schultz.Apex\src\clients\jobcenter-desktop\jobcenter-desktop-frontend\jdc.code-workspace | |
if ($Null -eq (Get-Process *devenv* | Where-Object { $_.MainWindowTitle -like "fasit-all *" })) { | |
& $GitRoot\Schultz.Apex\fasit-all.sln | |
} | |
Start-ApexInfrastructure | |
cd-fasit-jobcenter | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k yarn & yarn start" | |
cd-apex | |
break | |
} | |
"jdc-only" { | |
& $GitRoot\Schultz.Apex\src\clients\jobcenter-desktop\jobcenter-desktop-frontend\jdc.code-workspace | |
cd-fasit-jobcenter | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k yarn & yarn start" | |
cd-apex | |
break | |
} | |
"backend" { | |
if ($Null -eq (Get-Process *devenv* | Where-Object { $_.MainWindowTitle -like "fasit-all *" })) { | |
& $GitRoot\Schultz.Apex\fasit-all.sln | |
} | |
cd-apex | |
break | |
} | |
"apex-all" { | |
& $GitRoot\Schultz.Apex\src\fasit-search\Fasit.Search.FrontendService\ClientApp.code-workspace | |
if ($Null -eq (Get-Process *devenv* | Where-Object { $_.MainWindowTitle -like "fasit-all *" })) { | |
& $GitRoot\Schultz.Apex\fasit-all.sln | |
} | |
Start-ApexInfrastructure | |
cd-apexsearch | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k npm run start" | |
cd-apex | |
break | |
} | |
"apex-search" { | |
& $GitRoot\Schultz.Apex\src\fasit-search\Fasit.Search.FrontendService\ClientApp.code-workspace | |
Start-ApexInfrastructure | |
cd-apex | |
& .\local-profiles\start-fasit-search-frontendservice.ps1 | |
cd-apexsearch | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k npm run start" | |
cd-apex | |
break | |
} | |
"apex-search-ui" { | |
& $GitRoot\Schultz.Apex\src\fasit-search\Fasit.Search.FrontendService\ClientApp.code-workspace | |
cd-apexsearch | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k npm run start" | |
cd-apex | |
break | |
} | |
"apex-ui" { | |
& $GitRoot\Schultz.Apex\src\fasit-ui\shared-components.code-workspace | |
cd-apexui | |
Start-Process -FilePath "$env:comspec" -ArgumentList "/k npm run start" | |
break | |
} | |
default { | |
"Dont know $environment" | |
break | |
} | |
} | |
} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment