Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.43k stars 9.74k forks source link

`electron-builder` `livecheck` strategy for casks #10866

Closed vitorgalvao closed 3 years ago

vitorgalvao commented 3 years ago

Provide a detailed description of the proposed feature

A bunch of Electron apps use electron-builder appcasts which can be detected with find-appcast.

Since those appcasts are YAML files with a specific pattern, detecting versions is simple:

livecheck do
  url "https://s3.amazonaws.com/download.remnote.io/latest-mac.yml"
  strategy :page_match do |page|
    YAML.safe_load(page)["version"]
  end
end

These appcasts are somewhat common, which makes them good candidates for a new strategy.

What is the motivation for the feature?

Making simpler livechecks, which will result in more casks being up-to-date and less maintenance effort.

How will the feature be relevant to at least 90% of Homebrew users?

User who make casks will have an easier time doing so (in these specific cases). Users who use casks will benefit indirectly from casks which are easier to maintain.

What alternatives to the feature have been considered?

Doing it the long (well, medium) way as in the code block above.

samford commented 3 years ago

@vitorgalvao Nanda's ElectronBuilder strategy is now merged, so you can update related casks to simply use strategy :electron_builder and this will work in the same manner as the existing strategy blocks.

If you need to modify the version, you can access the yaml hash in the strategy block like so:

strategy :electron_builder do |yaml|
  yaml["version"]&.gsub(/\D/, "")
end