From a5ce373cbf49f2aaf2bd9a220e964f6c22fcd947 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 6 Apr 2021 18:01:22 +0300 Subject: [PATCH] Added pre-commit installation to windows deployment script --- deployment_scripts/deploy_windows.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/deployment_scripts/deploy_windows.ps1 b/deployment_scripts/deploy_windows.ps1 index 85a3f0698..bc781b546 100644 --- a/deployment_scripts/deploy_windows.ps1 +++ b/deployment_scripts/deploy_windows.ps1 @@ -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))