Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add utm parameter #27

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Conversation

sandor-trombitas
Copy link
Contributor

How to test:

cd script
ruby render.rb > test.rb
cat test.rb

class Snyk < Formula
  desc "Find & fix known vulnerabilities in open-source dependencies"
  homepage "https://github.com/snyk/snyk"
  version "1.1292.2"

  if OS.mac? && Hardware::CPU.intel?
    url "https://static.snyk.io/cli/v1.1292.2/snyk-macos?utm_source=homebrew"
    sha256 "efd066d52799fa964d6912d2cd94629c2ed2b014617107a1497efff2e09ef567"
    def install
      bin.install ("snyk-macos") => "snyk"
    end
  elsif OS.mac? && Hardware::CPU.arm?
    url "https://static.snyk.io/cli/v1.1292.2/snyk-macos-arm64?utm_source=homebrew"
    sha256 "54fcb68f6c13de740aef597bfae3f8d5faeac5db24c6c2f0040f7946292a6517"
    def install
      bin.install ("snyk-macos-arm64") => "snyk"
    end
  elsif OS.linux? && Hardware::CPU.intel?
    url "https://static.snyk.io/cli/v1.1292.2/snyk-linux?utm_source=homebrew"
    sha256 "4d4a81040a665428f3036f958a949621991a5501195d1345f17c260795009f1a"
    def install
      bin.install ("snyk-linux") => "snyk"
    end
  elsif OS.linux? && Hardware::CPU.arm?
    url "https://static.snyk.io/cli/v1.1292.2/snyk-linux-arm64?utm_source=homebrew"
    sha256 "5ddc071b56d31769c98fa06234b80e13e17a4505056f867c96b5abe8aeb3e865"
    def install
      bin.install ("snyk-linux-arm64") => "snyk"
    end
  end

  test do
    assert_match("Authentication failed.", shell_output("#{bin}/snyk auth homebrew-test", 2))
  end
end

@sandor-trombitas sandor-trombitas requested a review from a team as a code owner August 2, 2024 12:14
script/render.rb Outdated
@@ -25,9 +25,15 @@ def get_latest_release(bin)
obj = JSON.parse(data)
version = obj["version"]
url = obj["assets"][bin]["url"]
# Parse the URL and add the utm parameter
uri = URI.parse(url)
new_query_ar = URI.decode_www_form(uri.query || '') << ["utm_source", "homebrew"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: can we use uppercase HOMEBREW for the utm value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem 👍

@j-luong j-luong merged commit d5ab8df into master Aug 5, 2024
2 checks passed
@j-luong j-luong deleted the CLI-423-update-cli-download-url branch August 5, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants