Skip to content

Commit 6f02e61

Browse files
author
Kapil Borle
committed
Add install/uninstall tasks to build script
1 parent dca1fb7 commit 6f02e61

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.build.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,27 @@ task newSession {
229229
Start-Process "powershell" -ArgumentList @('-noexit', "-command import-module $modulePath -verbose")
230230
}
231231

232+
$localPSModulePath = $env:PSMODULEPATH -split ";" | Where-Object {$_.StartsWith($HOME)}
233+
$pssaDestModulePath = ''
234+
if ($null -ne $localPSModulePath -and $localPSModulePath.Count -eq 1) {
235+
$pssaDestModulePath = Join-Path $localPSModulePath 'PSScriptAnalyzer'
236+
}
237+
238+
function Test-PSSADestModulePath {
239+
($pssaDestModulePath -ne '') -and (Test-Path $pssaDestModulePath)
240+
}
241+
242+
task uninstall -if {Test-PSSADestModulePath} {
243+
Remove-Item -Force -Recurse $pssaDestModulePath
244+
}
245+
246+
task install -if {Test-Path $modulePath} uninstall,{
247+
Copy-Item `
248+
-Recurse `
249+
-Path $modulePath `
250+
-Destination $pssaDestModulePath
251+
}
252+
232253
# TODO fix building psv3
233254
task release cleanModule, clean, build, createModule, buildDocs
234255
task . build, createModule, newSession

0 commit comments

Comments
 (0)