diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 38952a9e49..6dc120b395 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -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? diff --git a/Library/Homebrew/extend/os/cask/dsl.rb b/Library/Homebrew/extend/os/cask/dsl.rb new file mode 100644 index 0000000000..1ee72f032f --- /dev/null +++ b/Library/Homebrew/extend/os/cask/dsl.rb @@ -0,0 +1,4 @@ +# typed: strict +# frozen_string_literal: true + +require "extend/os/mac/cask/dsl" if OS.mac? diff --git a/Library/Homebrew/extend/os/mac/cask/dsl.rb b/Library/Homebrew/extend/os/mac/cask/dsl.rb new file mode 100644 index 0000000000..252c6a16f5 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/cask/dsl.rb @@ -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)