Skip to content

Fixes #36 - Fix logic for AllowClobber and SkipPublisherCheck #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 35 additions & 33 deletions src/CompatPowerShellGet.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function Convert-VersionParamaters
elseif ( ! $RequiredVersion -and ! $MinimumVersion -and ! $MaximumVersion ) {
return $null
}
elseif ( $RequiredVersion -and ! $MinimumVersion -and ! $MaximumVersion ) {
elseif ( $RequiredVersion -and ! $MinimumVersion -and ! $MaximumVersion ) {
return "$RequiredVersion" }

# now return the appropriate string
Expand Down Expand Up @@ -462,7 +462,7 @@ param(
}

# PARAMETER MAP
# add new specifier
# add new specifier
$PSBoundParameters['Type'] = 'module'
# Parameter translations
$verArgs = @{}
Expand Down Expand Up @@ -659,7 +659,7 @@ param(
}

# PARAMETER MAP
# add new specifier
# add new specifier
$PSBoundParameters['Type'] = 'script'
# Parameter translations
$verArgs = @{}
Expand Down Expand Up @@ -1021,11 +1021,13 @@ param(
$PSBoundParameters['Version'] = $ver
}
if ( $PSBoundParameters['AllowPrerelease'] ) { $null = $PSBoundParameters.Remove('AllowPrerelease'); $PSBoundParameters['Prerelease'] = $AllowPrerelease }
if ( $PSBoundParameters['SkipPublisherCheck'] ) { $null = $PSBoundParameters.Remove('SkipPublisherCheck'); $PSBoundParameters['AuthenticodeCheck'] = $SkipPublisherCheck }
$PSBoundParameters['NoClobber'] = $true
if ( $PSBoundParameters['AllowClobber'] ) { $null = $PSBoundParameters.Remove('AllowClobber'); $PSBoundParameters['NoClobber'] = (-not $AllowClobber) }
$PSBoundParameters['AuthenticodeCheck'] = $true
if ( $PSBoundParameters['SkipPublisherCheck'] ) { $null = $PSBoundParameters.Remove('SkipPublisherCheck'); $PSBoundParameters['AuthenticodeCheck'] = (-not $SkipPublisherCheck) }
# Parameter Deletions (unsupported in v3)
if ( $PSBoundParameters['Proxy'] ) { $null = $PSBoundParameters.Remove('Proxy') }
if ( $PSBoundParameters['ProxyCredential'] ) { $null = $PSBoundParameters.Remove('ProxyCredential') }
if ( $PSBoundParameters['AllowClobber'] ) { $null = $PSBoundParameters.Remove('AllowClobber') }
if ( $PSBoundParameters['Force'] ) { $null = $PSBoundParameters.Remove('Force') }
# END PARAMETER MAP

Expand Down Expand Up @@ -1142,14 +1144,14 @@ param(
# PARAMETER MAP
# Parameter translations
$verArgs = @{}
if ( $PSBoundParameters['MinimumVersion'] ) { $null = $PSBoundParameters.Remove('MinimumVersion'); $verArgs['MinimumVersion'] = $MinimumVersion }
if ( $PSBoundParameters['MaximumVersion'] ) { $null = $PSBoundParameters.Remove('MaximumVersion'); $verArgs['MaximumVersion'] = $MaximumVersion }
if ( $PSBoundParameters['RequiredVersion'] ) { $null = $PSBoundParameters.Remove('RequiredVersion'); $verArgs['RequiredVersion'] = $RequiredVersion }
if ( $PSBoundParameters['MinimumVersion'] ) { $null = $PSBoundParameters.Remove('MinimumVersion'); $verArgs['MinimumVersion'] = $MinimumVersion }
if ( $PSBoundParameters['MaximumVersion'] ) { $null = $PSBoundParameters.Remove('MaximumVersion'); $verArgs['MaximumVersion'] = $MaximumVersion }
if ( $PSBoundParameters['RequiredVersion'] ) { $null = $PSBoundParameters.Remove('RequiredVersion'); $verArgs['RequiredVersion'] = $RequiredVersion }
$ver = Convert-VersionParamaters @verArgs
if ( $ver ) {
$PSBoundParameters['Version'] = $ver
}
if ( $PSBoundParameters['AllowPrerelease'] ) { $null = $PSBoundParameters.Remove('AllowPrerelease'); $PSBoundParameters['Prerelease'] = $AllowPrerelease }
if ( $PSBoundParameters['AllowPrerelease'] ) { $null = $PSBoundParameters.Remove('AllowPrerelease'); $PSBoundParameters['Prerelease'] = $AllowPrerelease }
# Parameter Deletions (unsupported in v3)
if ( $PSBoundParameters['NoPathUpdate'] ) { $null = $PSBoundParameters.Remove('NoPathUpdate') }
if ( $PSBoundParameters['Proxy'] ) { $null = $PSBoundParameters.Remove('Proxy') }
Expand Down Expand Up @@ -1201,11 +1203,11 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Version},

[ValidateNotNullOrEmpty()]
[string]
${Author},

[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]
Expand All @@ -1222,39 +1224,39 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Copyright},

[ValidateNotNullOrEmpty()]
[Object[]]
${RequiredModules},

[ValidateNotNullOrEmpty()]
[string[]]
${ExternalModuleDependencies},

[ValidateNotNullOrEmpty()]
[string[]]
${RequiredScripts},

[ValidateNotNullOrEmpty()]
[string[]]
${ExternalScriptDependencies},

[ValidateNotNullOrEmpty()]
[string[]]
${Tags},

[ValidateNotNullOrEmpty()]
[Uri]
${ProjectUri},

[ValidateNotNullOrEmpty()]
[Uri]
${LicenseUri},

[ValidateNotNullOrEmpty()]
[Uri]
${IconUri},

[string[]]
${ReleaseNotes},

Expand Down Expand Up @@ -1753,7 +1755,7 @@ param(
if ( $PSBoundParameters['Force'] ) { $null = $PSBoundParameters.Remove('Force') }
if ( $PSBoundParameters['AcceptLicense'] ) { $null = $PSBoundParameters.Remove('AcceptLicense') }
# END PARAMETER MAP

$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Save-PSResource', [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters }

Expand Down Expand Up @@ -2565,11 +2567,11 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Version},

[ValidateNotNullOrEmpty()]
[string]
${Author},

[ValidateNotNullOrEmpty()]
[string]
${Description},
Expand All @@ -2585,7 +2587,7 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Copyright},

[ValidateNotNullOrEmpty()]
[Object[]]
${RequiredModules},
Expand All @@ -2597,27 +2599,27 @@ param(
[ValidateNotNullOrEmpty()]
[string[]]
${RequiredScripts},

[ValidateNotNullOrEmpty()]
[string[]]
${ExternalScriptDependencies},

[ValidateNotNullOrEmpty()]
[string[]]
${Tags},

[ValidateNotNullOrEmpty()]
[Uri]
${ProjectUri},

[ValidateNotNullOrEmpty()]
[Uri]
${LicenseUri},

[ValidateNotNullOrEmpty()]
[Uri]
${IconUri},

[string[]]
${ReleaseNotes},

Expand Down Expand Up @@ -2694,11 +2696,11 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Version},

[ValidateNotNullOrEmpty()]
[string]
${Author},

[ValidateNotNullOrEmpty()]
[string]
${Description},
Expand All @@ -2714,7 +2716,7 @@ param(
[ValidateNotNullOrEmpty()]
[string]
${Copyright},

[ValidateNotNullOrEmpty()]
[Object[]]
${RequiredModules},
Expand All @@ -2726,27 +2728,27 @@ param(
[ValidateNotNullOrEmpty()]
[string[]]
${RequiredScripts},

[ValidateNotNullOrEmpty()]
[string[]]
${ExternalScriptDependencies},

[ValidateNotNullOrEmpty()]
[string[]]
${Tags},

[ValidateNotNullOrEmpty()]
[Uri]
${ProjectUri},

[ValidateNotNullOrEmpty()]
[Uri]
${LicenseUri},

[ValidateNotNullOrEmpty()]
[Uri]
${IconUri},

[string[]]
${ReleaseNotes},

Expand Down