Last active
February 9, 2017 14:01
-
-
Save serbrech/8333695 to your computer and use it in GitHub Desktop.
Powershell roundhouse wrapper
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
function Invoke-Roundhouse { | |
param( | |
[alias("env")]$environment="LOCAL", | |
$server="(local)", | |
$dbName="DB" | |
) | |
$scriptPath = Split-Path (Get-PSCallStack)[1].ScriptName | |
write-host "base path : $scriptPath" | |
$sql_files_directory= Join-Path $scriptPath "db\DBScriptFolder" | |
$version_file = Join-Path $scriptPath "outBin\SomeVersioned.dll" | |
$roundhouse = "$scriptPath/tools/roundhouse/rh.exe" | |
$arguments = @(); | |
$arguments += "-d `"$dbName`"" | |
$arguments += "-f `"$sql_files_directory`"" | |
$arguments += "-s `"$server`"" | |
$arguments += "-vf `"$version_file`"" | |
$arguments += "-env `"$environment`"" | |
$arguments += "-simple" | |
$arguments += "--silent" | |
write-host "Exe : $roundhouse" | |
write-host "Arguments: $arguments" | |
$process = (Start-Process $roundhouse -ArgumentList $arguments -NoNewWindow -Wait -Passthru) | |
write-host "Process exited with code : " $process.ExitCode | |
if( $process.ExitCode -ne 0 ) { | |
throw "Oops! Something when wrong when running roundhouse !!!" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment