Repository: axodotdev/cargo-dist
Pull request #348 (2023-08-21 22:34:28)

fix(homebrew): add explicit version tag
A real-world test indicated that Homebrew is reliably misparsing the version from the URLs. Instead of letting Homebrew guess, let's just be explicit.


Patch:
diff --git a/cargo-dist/templates/installer/homebrew.rb.j2 b/cargo-dist/templates/installer/homebrew.rb.j2
index cf8e7a83..a125a8a5 100644
--- a/cargo-dist/templates/installer/homebrew.rb.j2
+++ b/cargo-dist/templates/installer/homebrew.rb.j2
@@ -24,6 +24,7 @@ class {{ formula_class }} < Formula
     sha256 "{{ x86_64_sha256 }}"
     {%- endif %}
   end
+  version "{{ inner.app_version }}"
   {%- endif %}
   {#- #}
   {%- if license %}


Test patch:
diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap
index 013e2f70..c5a1da6d 100644
--- a/cargo-dist/tests/snapshots/akaikatana_basic.snap
+++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap
@@ -707,6 +707,7 @@ class AkaikatanaRepack < Formula
   else
     url "https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz"
   end
+  version "0.2.0"
   license "GPL-2.0-or-later"
 
   def install
diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
index df128e5b..cf976e20 100644
--- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap
+++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
@@ -708,6 +708,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_cargo_home.snap b/cargo-dist/tests/snapshots/install_path_cargo_home.snap
index 345d1fd8..eda0f60f 100644
--- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap
+++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap
@@ -708,6 +708,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
index 17e18797..11f99946 100644
--- a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_subdir.snap
index cf8b144e..41c58921 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
index 7c5f2b98..32eb272e 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
index c78dd4d2..21e3faf7 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
index 3c4d4f91..e985aaff 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
index cfa2452c..d7a0dd43 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
index afc03ee9..e1aafc74 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
index b129dc6c..47ef982a 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
@@ -691,6 +691,7 @@ class Axolotlsay < Formula
   else
     url "https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-x86_64-apple-darwin.tar.gz"
   end
+  version "0.1.0"
   license "MIT OR Apache-2.0"
 
   def install