# Generated by tinfoil <%= @tinfoil_version %>.
# This file is a template. `mix tinfoil.homebrew` fills in version,
# URLs, and SHA256 checksums from the published release assets and
# pushes the result to the tap repo.
class <%= @formula_class %> < Formula
  desc "<%= @description %>"
  homepage "<%= @homepage %>"
  version "__VERSION__"
  license "<%= @license %>"
<%= if :darwin_arm64 in @targets or :darwin_x86_64 in @targets do %>
  on_macos do<%= if :darwin_arm64 in @targets do %>
    on_arm do
      url "<%= @base_url %>/download/v__VERSION__/<%= @app %>-__VERSION__-aarch64-apple-darwin.tar.gz"
      sha256 "__SHA256_DARWIN_ARM64__"
    end<% end %><%= if :darwin_x86_64 in @targets do %>
    on_intel do
      url "<%= @base_url %>/download/v__VERSION__/<%= @app %>-__VERSION__-x86_64-apple-darwin.tar.gz"
      sha256 "__SHA256_DARWIN_X86_64__"
    end<% end %>
  end<% end %>
<%= if :linux_arm64 in @targets or :linux_x86_64 in @targets do %>
  on_linux do<%= if :linux_arm64 in @targets do %>
    on_arm do
      url "<%= @base_url %>/download/v__VERSION__/<%= @app %>-__VERSION__-aarch64-unknown-linux-musl.tar.gz"
      sha256 "__SHA256_LINUX_ARM64__"
    end<% end %><%= if :linux_x86_64 in @targets do %>
    on_intel do
      url "<%= @base_url %>/download/v__VERSION__/<%= @app %>-__VERSION__-x86_64-unknown-linux-musl.tar.gz"
      sha256 "__SHA256_LINUX_X86_64__"
    end<% end %>
  end<% end %>

  def install
    bin.install "<%= @app %>"
  end

  test do
    assert_match version.to_s, shell_output("#{bin}/<%= @app %> --version")
  end
end
