Commit eb1805a5 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(fix): Better init (clone) scripts

1 merge request!175WIP: Local stack tweaks
param(
[CmdletBinding()]
Param(
[switch] $Ssh
)
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"
Push-Location $PSScriptRoot
try {
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) {
If ($Ssh) {
$RemoteRoot = "git@gitlab.com:minds"
}
# Clone the main repo
git checkout master
git pull
Write-Host "Using $RemoteRoot"
# Setup the other repos
git clone $RemoteRoot/front.git front --config core.autocrlf=input
git clone $RemoteRoot/engine.git engine --config core.autocrlf=input
git clone $RemoteRoot/sockets.git socket --config core.autocrlf=input
# Fetch latest
Exec { git pull }
if ($LastExitCode -ne 0) {
throw "Something failed"
}
# 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 {
Catch {
Pop-Location
exit 1
Exit 1
}
finally {
Finally {
Pop-Location
exit 0
Exit 0
}
......@@ -31,10 +31,9 @@ fi
cd "$(dirname "${BASH_SOURCE[0]}")"
# Clone the main repo
git checkout master
git pull
# Setup the other repos
git clone $REMOTE_ROOT/front front --config core.autocrlf=input
git clone $REMOTE_ROOT/engine engine --config core.autocrlf=input
git clone $REMOTE_ROOT/sockets socket --config core.autocrlf=input
git clone $REMOTE_ROOT/sockets sockets --config core.autocrlf=input
Please register or to comment