Homebrew / homebrew-cask-versions

💀 Alternate versions of Casks (deprecated)
https://brew.sh
1.18k stars 1.06k forks source link

[Question] Is it possible to get `version` from a http response header? #11071

Closed Logicer16 closed 3 years ago

Logicer16 commented 3 years ago

After some investigation, I found that the version number for arduino-ide-nightly has the version number in one of the response headers in the current download url (specifically within the location header for the 302 redirect on https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_macOS_64bit.dmg).

So is there a proper way to get the header and set it to version after preforming a regex on it or is this not allowed. I'm not that familier with ruby, so if this is allowed and there is no preferred method could recommend me on what I should use.

cho-m commented 3 years ago

You can modify the version, sha, and url to match an exact version-number and then add a livecheck block using the :header_match strategy.

See the corresponding docs in https://docs.brew.sh/Cask-Cookbook#stanza-livecheck

Also try going through other Casks that use this strategy.

There is a default regex that is applied, which you can first try. If it doesn't work, you can refine it either with a regex(...) section, or you can use the strategy :header_match do |headers| logic for more complicated matches, similar to the :page_match strategy.

Logicer16 commented 3 years ago

I'm hesitant to set version to the exact version as its a nightly version and I doubt it will get people that are dedicated enough to bump the version each day, unlike google-chrome-canary and similar.

I''l just stick with :latest.