
This adds a `UsesOnSystem` class to `OnSystem`, containing boolean instance variables to indicate which types of on_system methods are used in a formula or cask. This is intended as a replacement for `@on_system_blocks_exist`, which doesn't allow us to determine what kinds of on_system calls were used. This provides more granularity but we can still use `@uses_on_system.present?` to determine whether any on_system calls were used (and this doubles as a `nil` check in `Formula`, as the `self.class` instance variable has to use a nilable type). The `UsesOnSystem` instance variables cover the current `ARCH_OPTIONS` and `BASE_OS_OPTIONS`. At the moment, we mostly need to tell whether there are macOS/Linux or Intel/ARM on_system calls, so I've omitted instance variables for specific macOS version until we have a need for them. As a practical example, if you wanted to determine whether a cask uses Linux on_system calls, you can call `cask.uses_on_system.linux?`. The `linux` boolean will be `true` if the cask has an `on_linux` block, an `on_system` block (which requires Linux), or uses `os linux: ...`. This is something that would be challenging to determine from outside of `OnSystem` but it's relatively easy to collect the information in `OnSystem` methods and make it available like this.
20 lines
525 B
Ruby
20 lines
525 B
Ruby
cask "with-on-macos-version-blocks" do
|
|
on_big_sur :or_older do
|
|
version "1.2.3"
|
|
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
|
|
end
|
|
on_monterey do
|
|
version "1.2.4"
|
|
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
|
end
|
|
on_ventura :or_newer do
|
|
version "1.2.5"
|
|
sha256 "306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb"
|
|
end
|
|
|
|
url "https://brew.sh/TestCask-#{version}.dmg"
|
|
homepage "https://brew.sh/"
|
|
|
|
app "TestCask.app"
|
|
end
|