-
Notifications
You must be signed in to change notification settings - Fork 203
/
init.ps1
48 lines (40 loc) · 1007 Bytes
/
init.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
37
38
39
40
41
42
43
44
45
46
47
48
[CmdletBinding()]
Param(
[switch] $Ssh
)
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"
Push-Location $PSScriptRoot
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ("Error executing command {0}" -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
Throw ("Exec: " + $errorMessage)
}
}
Try {
$RemoteRoot = "https://gitlab.com/minds"
If ($Ssh) {
$RemoteRoot = "[email protected]:minds"
}
Write-Host "Using $RemoteRoot"
# Fetch latest
Exec { git pull }
# Setup the other repos
Exec { git clone $RemoteRoot/front.git front --config core.autocrlf=input }
Exec { git clone $RemoteRoot/engine.git engine --config core.autocrlf=input }
Exec { git clone $RemoteRoot/sockets.git sockets --config core.autocrlf=input }
}
Catch {
Pop-Location
Exit 1
}
Finally {
Pop-Location
Exit 0
}