Added pre-commit installation to windows deployment script

This commit is contained in:
VakarisZ 2021-04-06 18:01:22 +03:00 committed by Mike Salvatore
parent 575b214c8e
commit a5ce373cbf
1 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,21 @@ param(
[Bool]
$agents = $true
)
function Configure-precommit([String] $python_command)
{
Write-Output "Installing pre-commit and setting up pre-commit hook"
python -m pip install pre-commit
if ($LastExitCode) {
exit
}
pre-commit install
if ($LastExitCode) {
exit
}
Write-Output "Pre-commit successfully installed"
}
function Deploy-Windows([String] $monkey_home = (Get-Item -Path ".\").FullName, [String] $branch = "develop")
{
Write-Output "Downloading to $monkey_home"
@ -119,6 +134,8 @@ function Deploy-Windows([String] $monkey_home = (Get-Item -Path ".\").FullName,
$scoutsuiteRequirements = Join-Path -Path $monkey_home -ChildPath $SCOUTSUITE_DIR | Join-Path -ChildPath "\requirements.txt"
& python -m pip install --user -r $scoutsuiteRequirements
Configure-precommit
$user_python_dir = cmd.exe /c 'py -m site --user-site'
$user_python_dir = Join-Path (Split-Path $user_python_dir) -ChildPath "\Scripts"
if (!($ENV:Path | Select-String -SimpleMatch $user_python_dir))