33# winget settings --enable LocalManifestFiles
44# winget settings --enable InstallerHashOverride
55
6- use common .nu [check-user-install, check-version-match, check-local-machine-install ]
6+ use winget-install .nu [prepare-manifest ]
7+ use common .nu [check-user-install, check-version-match, check-local-machine-install, get-latest-tag ]
78
89const VERSION = ' 0.105.1'
910const PREV_VERSION = ' 0.105.0'
@@ -19,15 +20,16 @@ const WINGET_ARGS = [
1920 --accept-package-agreements
2021 ]
2122
22- def main [-- msi(-m) ] {
23- if $msi {
23+ def main [-- msi(-m), -- local ] {
24+ if $msi and $local {
2425 test-msi-per-user-install
2526 test-msi-per-machine-install
2627 }
27- test-winget-per-user-install
28- test-winget-per-user-upgrade
29- test-winget-per-machine-install
30- test-winget-per-machine-upgrade
28+ if not $local { prepare-manifest }
29+ test-winget-per-user-install -- local=$local
30+ test-winget-per-user-upgrade -- local=$local
31+ test-winget-per-machine-install -- local=$local
32+ test-winget-per-machine-upgrade -- local=$local
3133}
3234
3335export def test-msi-per-user-install [] {
@@ -50,41 +52,61 @@ export def test-msi-per-machine-install [] {
5052 winget list nushell -- accept-source-agreements
5153}
5254
53- export def test-winget-per-user-install [] {
55+ export def test-winget-per-user-install [-- local ] {
5456 winget uninstall nushell | complete
5557 print $' (char nl )Using winget to test MSI (ansi g )user scope(ansi reset ) installation'
5658 print ' -------------------------------------------------------------------'
57- winget install -- manifest $' manifests\n\Nushell\Nushell\($PREV_VERSION )\' ... $WINGET_ARGS -- scope user
59+ if $local {
60+ winget install -- manifest $' manifests\n\Nushell\Nushell\($PREV_VERSION )\' ... $WINGET_ARGS -- scope user
61+ check-version-match $PREV_VERSION $PER_USER_INSTALL_DIR
62+ } else {
63+ winget install -- id Nushell.Nushell ... $WINGET_ARGS -- scope user
64+ }
5865 check-user-install $PER_USER_INSTALL_DIR
59- check-version-match $PREV_VERSION $PER_USER_INSTALL_DIR
6066 winget list nushell -- accept-source-agreements
6167}
6268
63- export def test-winget-per-user-upgrade [] {
69+ export def test-winget-per-user-upgrade [-- local ] {
6470 print $' (char nl )Using winget to test MSI (ansi g )user scope(ansi reset ) upgrade'
6571 print ' -------------------------------------------------------------------'
6672 # winget upgrade does not work for user scope due to https://github.com/microsoft/winget-cli/issues/3011
67- winget install -- manifest $' manifests\n\Nushell\Nushell\($LAST_VERSION )\' ... $WINGET_ARGS -- scope user
73+ if $local {
74+ winget install -- manifest $' manifests\n\Nushell\Nushell\($LAST_VERSION )\' ... $WINGET_ARGS -- scope user
75+ check-version-match $LAST_VERSION $PER_USER_INSTALL_DIR
76+ } else {
77+ let version = get-latest-tag | split row + | first
78+ winget install -- manifest $' manifests\n\Nushell\Nushell\($version )\' ... $WINGET_ARGS -- scope user
79+ check-version-match $version $PER_USER_INSTALL_DIR
80+ }
6881 check-user-install $PER_USER_INSTALL_DIR
69- check-version-match $LAST_VERSION $PER_USER_INSTALL_DIR
7082 winget list nushell -- accept-source-agreements
7183}
7284
73- export def test-winget-per-machine-install [] {
85+ export def test-winget-per-machine-install [-- local ] {
7486 winget uninstall nushell | complete
7587 print $' (char nl )Using winget to test MSI (ansi g )machine scope(ansi reset ) installation'
7688 print ' -------------------------------------------------------------------'
77- winget install -- manifest $' manifests\n\Nushell\Nushell\($PREV_VERSION )\' ... $WINGET_ARGS -- scope machine
89+ if $local {
90+ winget install -- manifest $' manifests\n\Nushell\Nushell\($PREV_VERSION )\' ... $WINGET_ARGS -- scope machine
91+ check-version-match $PREV_VERSION $PER_MACHINE_INSTALL_DIR
92+ } else {
93+ winget install -- id Nushell.Nushell ... $WINGET_ARGS -- scope machine
94+ }
7895 check-local-machine-install
79- check-version-match $PREV_VERSION $PER_MACHINE_INSTALL_DIR
8096 winget list nushell -- accept-source-agreements
8197}
8298
83- export def test-winget-per-machine-upgrade [] {
99+ export def test-winget-per-machine-upgrade [-- local ] {
84100 print $' (char nl )Using winget to test MSI (ansi g )machine scope(ansi reset ) upgrade'
85101 print ' -------------------------------------------------------------------'
86- winget upgrade -- manifest $' manifests\n\Nushell\Nushell\($LAST_VERSION )\' ... $WINGET_ARGS
102+ if $local {
103+ winget upgrade -- manifest $' manifests\n\Nushell\Nushell\($LAST_VERSION )\' ... $WINGET_ARGS
104+ check-version-match $LAST_VERSION $PER_MACHINE_INSTALL_DIR
105+ } else {
106+ let version = get-latest-tag | split row + | first
107+ winget upgrade -- manifest $' manifests\n\Nushell\Nushell\($version )\' ... $WINGET_ARGS
108+ check-version-match $version $PER_MACHINE_INSTALL_DIR
109+ }
87110 check-local-machine-install
88- check-version-match $LAST_VERSION $PER_MACHINE_INSTALL_DIR
89111 winget list nushell -- accept-source-agreements
90112}
0 commit comments