feat: add os_version for casks

This commit is contained in:
Sean Molenaar 2025-03-03 17:55:10 +01:00
parent 55b07d7fed
commit ab2b18f78c
3 changed files with 35 additions and 0 deletions

View File

@ -452,6 +452,7 @@ module Cask
@artifacts ||= ArtifactSet.new
end
sig { returns(Pathname) }
def caskroom_path
cask.caskroom_path
end
@ -459,6 +460,7 @@ module Cask
# The staged location for this cask, including version number.
#
# @api public
sig { returns(Pathname) }
def staged_path
return @staged_path if @staged_path
@ -590,9 +592,15 @@ module Cask
true
end
sig { returns(T.nilable(MacOSVersion)) }
def os_version
nil
end
# The directory `app`s are installed into.
#
# @api public
sig { returns(T.any(Pathname, String)) }
def appdir
return HOMEBREW_CASK_APPDIR_PLACEHOLDER if Cask.generating_hash?

View File

@ -0,0 +1,4 @@
# typed: strict
# frozen_string_literal: true
require "extend/os/mac/cask/dsl" if OS.mac?

View File

@ -0,0 +1,23 @@
# typed: strict
# frozen_string_literal: true
require "cask/macos"
module OS
module Mac
module Cask
module DSL
extend T::Helpers
requires_ancestor { ::Cask::DSL }
sig { returns(T.nilable(MacOSVersion)) }
def os_version
MacOS.full_version
end
end
end
end
end
Cask::DSL.prepend(OS::Mac::Cask::DSL)