Repository: axodotdev/cargo-dist (rust)

Issue:
Followup: one specific standalone updater is still broken
In reviewing shell installers produced after #1444, which was the fix for #1443, I'm still seeing the updater missing for one platform. Reviewing the actual data we're working off of, `archive.updater` is `None` for this one platform; it's assigned properly for every other platform. Here's an example from a generated shell installer produced from git HEAD.

```sh
    case "$_artifact_name" in 
        "axolotlsay-aarch64-apple-darwin.tar.xz")
            _arch="aarch64-apple-darwin"
            _zip_ext=".tar.xz"
            _bins="axolotlsay"
            _bins_js_array='"axolotlsay"'
            _libs=""
            _libs_js_array=""
            _staticlibs=""
            _staticlibs_js_array=""
            _updater_name=""
            _updater_bin=""
            ;;
        "axolotlsay-x86_64-apple-darwin.tar.xz")
            _arch="x86_64-apple-darwin"
            _zip_ext=".tar.xz"
            _bins="axolotlsay"
            _bins_js_array='"axolotlsay"'
            _libs=""
            _libs_js_array=""
            _staticlibs=""
            _staticlibs_js_array=""
            _updater_name="axolotlsay-x86_64-apple-darwin-update"
            _updater_bin="axolotlsay-x86_64-apple-darwin-update"
            ;;
        "axolotlsay-x86_64-pc-windows-msvc.zip")
            _arch="x86_64-pc-windows-msvc"
            _zip_ext=".zip"
            _bins="axolotlsay.exe"
            _bins_js_array='"axolotlsay.exe"'
            _libs=""
            _libs_js_array=""
            _staticlibs=""
            _staticlibs_js_array=""
            _updater_name="axolotlsay-x86_64-pc-windows-msvc-update"
            _updater_bin="axolotlsay-x86_64-pc-windows-msvc-update"
            ;;
        "axolotlsay-x86_64-unknown-linux-gnu.tar.xz")
            _arch="x86_64-unknown-linux-gnu"
            _zip_ext=".tar.xz"
            _bins="axolotlsay"
            _bins_js_array='"axolotlsay"'
            _libs=""
            _libs_js_array=""
            _staticlibs=""
            _staticlibs_js_array=""
            _updater_name="axolotlsay-x86_64-unknown-linux-gnu-update"
            _updater_bin="axolotlsay-x86_64-unknown-linux-gnu-update"
            ;;
```

Pull request description:
fix: invalid updater for first in array
Because minijinja's syntax derives from Python, it's also inherited Python's semantics for falsiness. `0` is falsy and, in this context, so is `Some(0)`. The result is that `if archive.updater` wasn't just checking for definedness but for truthiness, and it would be false for the updater with index `0`.

Fixes #1450.

Patch:
diff --git a/cargo-dist/templates/installer/installer.sh.j2 b/cargo-dist/templates/installer/installer.sh.j2
index 2abddd07..5310c300 100644
--- a/cargo-dist/templates/installer/installer.sh.j2
+++ b/cargo-dist/templates/installer/installer.sh.j2
@@ -175,7 +175,7 @@ download_binary_and_run_installer() {
             _staticlibs=""
             _staticlibs_js_array=""
             {%- endif %}
-            {%- if archive.updater %}
+            {%- if archive.updater != None %}
             _updater_name="{{ platform_support.updaters[archive.updater].id }}"
             _updater_bin="{{ platform_support.updaters[archive.updater].binary }}"
             {%- else %}


Test patch:
diff --git a/cargo-dist/tests/snapshots/akaikatana_updaters.snap b/cargo-dist/tests/snapshots/akaikatana_updaters.snap
index f0bc98da..3f88c365 100644
--- a/cargo-dist/tests/snapshots/akaikatana_updaters.snap
+++ b/cargo-dist/tests/snapshots/akaikatana_updaters.snap
@@ -161,8 +161,8 @@ download_binary_and_run_installer() {
             _libs_js_array=""
             _staticlibs=""
             _staticlibs_js_array=""
-            _updater_name=""
-            _updater_bin=""
+            _updater_name="akaikatana-repack-aarch64-apple-darwin-update"
+            _updater_bin="akaikatana-repack-aarch64-apple-darwin-update"
             ;;
         "akaikatana-repack-x86_64-apple-darwin.tar.xz")
             _arch="x86_64-apple-darwin"
diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap
index 45a84bb6..92b64eb8 100644
--- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap
+++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap
@@ -161,8 +161,8 @@ download_binary_and_run_installer() {
             _libs_js_array=""
             _staticlibs=""
             _staticlibs_js_array=""
-            _updater_name=""
-            _updater_bin=""
+            _updater_name="axolotlsay-aarch64-apple-darwin-update"
+            _updater_bin="axolotlsay-aarch64-apple-darwin-update"
             ;;
         "axolotlsay-x86_64-apple-darwin.tar.gz")
             _arch="x86_64-apple-darwin"