Skip to content

Commit

Permalink
feat(checkver): Ignore disable property when -Force is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Mar 12, 2021
1 parent e640392 commit 4fb735c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- **format**: Extract checkver fixes into own function and add generic adjust property function
- **schema**
- Add `disable` property to `checkver` and `autoupdate`
- `-Force` will ignore this property
- Remove deprecated short properties
- Cleanup descriptions
- Remove deprecated functions from code-base
Expand Down
14 changes: 7 additions & 7 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ function Invoke-Check {
}

# Forcing an update implies updating
if ($ForceUpdate) { $Update = $true }
if ($ForceUpdate) {
$Update = $true
} elseif ($Update -and ($json.autoupdate.disable -and ($json.autoupdate.disable -eq $true))) {
Write-UserMessage "${appName}: Skipping disabled autoupdate" -Info
return
}

if ($Update -and $json.autoupdate) {
if ($json.autoupdate.disable -and ($json.autoupdate.disable -eq $true)) {
Write-UserMessage "${appName}: Skipping disabled autoupdate" -Info
return
}

if ($ForceUpdate) { Write-UserMessage -Message 'Forcing autoupdate!' -Color 'DarkMagenta' }
if ($Version -ne '') { $ver = $Version }

Expand Down Expand Up @@ -238,7 +238,7 @@ foreach ($ff in Get-ChildItem $Dir "$Search.*" -File) {
continue
}
if ($m.checkver) {
if ($m.checkver.disable -and ($m.checkver.disable -eq $true)) {
if (!$ForceUpdate -and ($m.checkver.disable -and ($m.checkver.disable -eq $true))) {
Write-UserMessage "$($ff.BaseName): Skipping disabled checkver" -Info
continue
}
Expand Down
4 changes: 2 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"disable": {
"description": "Specifies to not execute checkver script without deleting whole property.",
"description": "Specifies to not execute checkver script without deleting whole property. Forcing checkver will ignore this setting.",
"type": "boolean"
}
}
Expand Down Expand Up @@ -437,7 +437,7 @@
"type": "string"
},
"disable": {
"description": "Specifies to prevent autoupdating of manifest without deleting whole property.",
"description": "Specifies to prevent autoupdating of manifest without deleting whole property. Forcing checkver will ignore this setting.",
"type": "boolean"
}
}
Expand Down

0 comments on commit 4fb735c

Please sign in to comment.