This repository has been archived on 2023-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
DroneHelper/tools/DevDependency.psm1

65 lines
2.2 KiB
PowerShell
Raw Normal View History

function Invoke-FixDevDependency {
<#
.SYNOPSIS
Installs dev dependencies.
.DESCRIPTION
Invoke-FixDevDependency acts as workaround to load the dependencies needed to load the pwsh module.
This is just standalone version of the embedded `Invoke-InstallDependency` which can't be called
by the DroneHelper build pipeline itself.
#>
[CmdletBinding()]
param ()
process {
try {
$PSScriptParams = @{
Name = 'PSScriptAnalyzer'
Scope = 'CurrentUser'
RequiredVersion = '1.20.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PSScriptParams
$PesterParams = @{
Name = 'Pester'
Scope = 'CurrentUser'
RequiredVersion = '5.3.1'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PesterParams
$PoshParams = @{
Name = 'posh-git'
Scope = 'CurrentUser'
RequiredVersion = '1.1.0'
Force = $true
SkipPublisherCheck = $true
AllowClobber = $true
Verbose = $VerbosePreference
ErrorAction = 'Stop'
}
Install-Module @PoshParams
}
catch {
$ExecParams = @{
Exception = [System.Exception]::new(
'Could not install required build dependencies!',
$PSItem.Exception
)
ErrorAction = 'Stop'
}
Write-Error @ExecParams
}
}
}