Skip to content

Commit

Permalink
Move parsing 'innosetup' to 'install.ps1'
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Jun 12, 2019
1 parent 4a3293b commit 784edbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
9 changes: 9 additions & 0 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
return
}

# Change 'innosetup' to 'installer.type:inno'
if ($manifest.innosetup) {
if ($manifest.installer) {
$manifest.installer | Add-Member -MemberType NoteProperty -Name type -Value 'inno'
} else {
$manifest | Add-Member -MemberType NoteProperty -Name installer -Value @{ type = 'inno' }
}
}

write-output "Installing '$app' ($version) [$architecture]"

$dir = ensure (versiondir $app $version $global)
Expand Down
20 changes: 2 additions & 18 deletions lib/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ function manifest_path($app, $bucket) {

function parse_json($path) {
if(!(test-path $path)) { return $null }
$json = Get-Content $path -raw -Encoding UTF8 | convertfrom-json -ea stop
if ($json.innosetup) {
if ($json.installer) {
$json.installer | Add-Member -MemberType NoteProperty -Name type -Value 'inno'
} else {
$json | Add-Member -MemberType NoteProperty -Name installer -Value @{type = 'inno'}
}
}
return ($json | Select-Object -Property * -ExcludeProperty "innosetup")
Get-Content $path -raw -Encoding UTF8 | convertfrom-json -ea stop
}

function url_manifest($url) {
Expand All @@ -30,15 +22,7 @@ function url_manifest($url) {
throw
}
if(!$str) { return $null }
$json = $str | convertfrom-json
if ($json.innosetup) {
if ($json.installer) {
$json.installer | Add-Member -MemberType NoteProperty -Name type -Value 'inno'
} else {
$json | Add-Member -MemberType NoteProperty -Name installer -Value @{type = 'inno'}
}
}
return ($json | Select-Object -Property * -ExcludeProperty "innosetup")
$str | convertfrom-json
}

function manifest($app, $bucket, $url) {
Expand Down

0 comments on commit 784edbf

Please sign in to comment.