Core/Deployer-Module.psm1
$ErrorActionPreference = "Stop" function InitializeDeployer { [CmdletBinding()] Param ( [string]$SolutionFile ) Write-Output "Initialiazing SAF Deployer..." $safRootDir = Split-Path "$SolutionFile" $safDir = Join-Path $safRootDir "_saf" if (!(Test-Path "$safDir")) { New-Item -Path "$safDir" -Type Directory -Force | Out-Null } Copy-Item -Path "$PSScriptRoot\Templates\saf_deployer.exe" -Destination "$safDir" -Force | Out-Null Write-Output "Done." } function NewDeploymentPackage { [CmdletBinding()] Param ( [string]$SolutionFile ) $safRootDir = Split-Path "$SolutionFile" $cakeBuildFile = GetCakeBuildFilePath -CurrentDirectory "$safRootDir" if ($null -eq $cakeBuildFile) { Write-Warning "SAF was not able to find the Cake build file." Write-Warning "Please, add 'cake.build' file to your solution." Write-Warning "If you already have added 'cake.build' file, right click on it and run 'SAF -> Initialize Cake Build'." } else { $cakeFile = "$cakeBuildFile".Replace(".ps1", ".cake") $deploymentTarget = GetCakeBuildStringProperty -CakeFile "$cakeFile" -PropertyName "BuildConfiguration" $safExe = Join-Path "$safRootDir" "_saf\saf_deployer.exe" InvokeProcess -FilePath "$safExe" -ArgumentList "NewPackage $deploymentTarget" exit $LASTEXITCODE } } function NewDeploymentTag { [CmdletBinding()] Param ( [string]$SolutionFile ) $safRootDir = Split-Path "$SolutionFile" $cakeBuildFile = GetCakeBuildFilePath -CurrentDirectory "$safRootDir" if ($null -eq $cakeBuildFile) { Write-Warning "SAF was not able to find the Cake build file." Write-Warning "Please, add 'cake.build' file to your solution." Write-Warning "If you already have added 'cake.build' file, right click on it and run 'SAF -> Initialize Cake Build'." } else { $cakeFile = "$cakeBuildFile".Replace(".ps1", ".cake") $deploymentTarget = GetCakeBuildStringProperty -CakeFile "$cakeFile" -PropertyName "BuildConfiguration" $safExe = Join-Path "$safRootDir" "_saf\saf_deployer.exe" InvokeProcess -FilePath "$safExe" -ArgumentList "NewTag $deploymentTarget" exit $LASTEXITCODE } } Export-ModuleMember -Function "InitializeDeployer" Export-ModuleMember -Function "NewDeploymentPackage" Export-ModuleMember -Function "NewDeploymentTag" |