73 lines
2.3 KiB
PowerShell
73 lines
2.3 KiB
PowerShell
|
function Invoke-InstallDependency {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Install required modules for executing the DroneHelper pipeline helpers.
|
||
|
|
||
|
.DESCRIPTION
|
||
|
This can be used in drone.io docker pipeline if the modules are not integrated in the build image.
|
||
|
|
||
|
.INPUTS
|
||
|
[None] No Input required.
|
||
|
|
||
|
.OUTPUTS
|
||
|
[None] No Output
|
||
|
|
||
|
.EXAMPLE
|
||
|
Import-Module -Name DroneHelper; Invoke-Install-Dependency
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType()]
|
||
|
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.0.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
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|