Skip to content

Commit

Permalink
checkver: add 'jsonpath' alias for 'jp'
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Kuhnt committed Sep 18, 2018
1 parent 468649c commit 76fdb6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ $queue | ForEach-Object {
if($json.checkver.jp) {
$jsonpath = $json.checkver.jp
}
if($json.checkver.jsonpath) {
$jsonpath = $json.checkver.jsonpath
}

if ($json.checkver.replace -and $json.checkver.replace.GetType() -eq [System.String]) {
$replace = $json.checkver.replace
Expand Down
10 changes: 8 additions & 2 deletions lib/autoupdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
$hashmode = 'extract'
}

if ($config.jp.Length -gt 0) {
$jsonpath = ''
if ($config.jp) {
$jsonpath = $config.jp
$hashmode = 'json'
}
if ($config.jsonpath) {
$jsonpath = $config.jsonpath
$hashmode = 'json'
}

Expand All @@ -175,7 +181,7 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
$hash = find_hash_in_textfile $hashfile_url $basename $config.find
}
'json' {
$hash = find_hash_in_json $hashfile_url $basename $config.jp
$hash = find_hash_in_json $hashfile_url $basename $jsonpath
}
'rdf' {
$hash = find_hash_in_rdf $hashfile_url $basename
Expand Down
10 changes: 10 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"type": "string"
},
"jp": {
"pattern": "^\\$\\..*$",
"type": "string",
"description": "Same as 'jsonpath'"
},
"jsonpath": {
"pattern": "^\\$\\..*$",
"type": "string"
},
Expand Down Expand Up @@ -216,6 +221,11 @@
"type": "string"
},
"jp": {
"pattern": "^\\$\\..*$",
"type": "string",
"description": "Same as 'jsonpath'"
},
"jsonpath": {
"pattern": "^\\$\\..*$",
"type": "string"
},
Expand Down

0 comments on commit 76fdb6b

Please sign in to comment.