From 9f86380af6fcf9611f7dbb609140ba8672a3e15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Fri, 11 Dec 2020 02:01:32 +0000 Subject: [PATCH] version.md: mention :latest (#95208) --- doc/cask_language_reference/stanzas/version.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/cask_language_reference/stanzas/version.md b/doc/cask_language_reference/stanzas/version.md index 26ddc5ffbf..b2aede3cc0 100644 --- a/doc/cask_language_reference/stanzas/version.md +++ b/doc/cask_language_reference/stanzas/version.md @@ -1,6 +1,6 @@ # version -`version`, while related to the app’s own versioning, doesn’t have to follow it exactly. It is common to change it slightly so it can be [interpolated](https://en.wikipedia.org/wiki/String_interpolation#Ruby) in other stanzas, usually in `url` to create a Cask that only needs `version` and `sha256` changes when updated. This can be taken further, when needed, with [ruby String methods](https://ruby-doc.org/core/String.html). +`version`, while related to the app’s own versioning, doesn’t have to follow it exactly. It is common to change it slightly so it can be [interpolated](https://en.wikipedia.org/wiki/String_interpolation#Ruby_/_Crystal) in other stanzas, usually in `url` to create a Cask that only needs `version` and `sha256` changes when updated. This can be taken further, when needed, with [ruby String methods](https://ruby-doc.org/core/String.html). For example: @@ -32,6 +32,15 @@ version "1.2.3build4" url "https://example.com/#{version.sub(%r{build\d+}, '')}/file-version-#{version}.dmg" ``` +## version :latest + +The special value `:latest` is used on casks which: + +1. `url` doesn’t contain a version. +2. Having a correct value to `version` is too difficult or impractical, even with our automated systems. + +Example: [spotify.rb](https://github.com/Homebrew/homebrew-cask/blob/f56e8ba057687690e26a6502623aa9476ff4ac0e/Casks/spotify.rb#L2) + ## version methods The examples above can become hard to read, however. Since many of these changes are common, we provide a number of helpers to clearly interpret otherwise obtuse cases: