cmds/Start-RlsrEngine.ps1
function Start-RlsrEngine { [CmdletBinding()] param ( [Parameter(HelpMessage="The path to the directory containg the rlsr project files")] [string] $Path = "$Pwd", [Parameter(HelpMessage="The base name of the rlsr project files to use")] [string] $Name = '*' ) end { $ErrorActionPreference = 'Stop' Write-Verbose -Message "Engine Values: Path=$Path, Name=$Name" $Path = Resolve-Path -Path $Path Write-Verbose -Message "Directory Path: $Path" $p = New-RlsrProject $p.Cfg = Import-RlsrCfgFile -Path $Path -Name $Name $p.Lock = Import-RlsrLock -CfgPath $p.Cfg.FullPath $p.Manifest = Test-ModuleManifest -Path "$Path\$($p.Cfg.ModuleName).psd1" $p.Timestamp = [DateTime]::NoW.ToString('yyyyMMddHHmmss') $p.RunName = $p.Cfg.ModuleName + '::' + $p.Timestamp $p.Status = 'Running' $p.Running = $true Write-Verbose -Message "Engine Starting: RUN $($p.RunName) For Module $($p.Cfg.ModuleName) CI process started" $p.Cfg.TaskSequence | ForEach-Object { $taskname = "$PSItem" Write-Verbose -Message "Task Invocation: $taskname invoked" $ok = $RlsrEngine.Tasks[$taskname].InvokeTask(([ref]$p)) $p.Running = $false if ($ok -eq $true) { $p.Status = 'Completed' Write-Verbose -Message "Task Success: $taskname successful" } else { $p.Status = 'Failed' } } $RlsrEngine.Projects += $p } } |