Class: Cask::DSL::Caveats Private

Inherits:
Base show all
Defined in:
cask/dsl/caveats.rb,
sorbet/rbi/dsl/cask/dsl/caveats.rbi

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Class corresponding to the caveats stanza.

Each method should handle output, following the convention of at least one trailing blank line so that the user can distinguish separate caveats.

The return value of the last method in the block is also sent to the output by the caller, but that feature is only for the convenience of cask authors.

Constant Summary collapse

CONDITIONAL_CAVEATS =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

Built-in caveats that have runtime conditions (arch, prefix, etc.) and should not be pre-serialized into the API JSON string.

[:requires_rosetta, :files_in_usr_local].freeze

Instance Attribute Summary

Attributes inherited from Base

#cask, #command

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#appdir, #arch, #caskroom_path, #language, #method_missing, #respond_to_missing?, #staged_path, #system_command, #token, #version

Methods included from Utils::Path

formula_installed_prefixes, formula_opt_bin_env, formula_opt_bin_path, install_info, loadable_package_path?, uninstall_info

Methods included from Utils::Path::Helpers

#child_of?, #cp_path_sub, #ensure_child_of!, #ensure_writable, #resolved_path, #resolved_path_exists?, #rmdir_if_possible, #text_executable?

Methods included from Utils::Path::FormulaHelpers

#formula_any_version_installed?, #formula_opt_bin, #formula_opt_include, #formula_opt_lib, #formula_opt_libexec, #formula_opt_prefix

Constructor Details

#initialize(*args) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)


23
24
25
26
27
28
29
# File 'cask/dsl/caveats.rb', line 23

def initialize(*args)
  super
  @built_in_caveats = T.let({}, T::Hash[T::Array[T.any(String, Symbol)], String])
  @custom_caveats = T.let([], T::Array[String])
  @discontinued = T.let(false, T::Boolean)
  @invoked_caveats = T.let(Set.new, T::Set[Symbol])
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cask::DSL::Base

Class Method Details

.caveat_namesArray<Symbol>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



32
33
34
# File 'cask/dsl/caveats.rb', line 32

def self.caveat_names
  @caveat_names ||= T.let([], T.nilable(T::Array[Symbol]))
end

Instance Method Details

#depends_on_java(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



10
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 10

def depends_on_java(*args); end

#discontinued?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


54
# File 'cask/dsl/caveats.rb', line 54

def discontinued? = @discontinued

#eval_caveats(&block) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:



86
87
88
89
90
91
92
# File 'cask/dsl/caveats.rb', line 86

def eval_caveats(&block)
  result = instance_eval(&block)
  return unless result
  return if result == :built_in_caveat

  @custom_caveats << result.to_s.sub(/\s*\Z/, "\n")
end

#files_in_usr_local(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



13
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 13

def files_in_usr_local(*args); end

#free_license(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



16
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 16

def free_license(*args); end

#invoked?(name) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Boolean)


74
75
76
# File 'cask/dsl/caveats.rb', line 74

def invoked?(name)
  @invoked_caveats.include?(name)
end

#kext(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



19
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 19

def kext(*args); end

#license(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



22
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 22

def license(*args); end

#logout(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



25
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 25

def logout(*args); end

#path_environment_variable(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



28
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 28

def path_environment_variable(*args); end

#puts(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Override puts to collect caveats.

Parameters:

Returns:



80
81
82
83
# File 'cask/dsl/caveats.rb', line 80

def puts(*args)
  @custom_caveats += args
  :built_in_caveat
end

#reboot(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



31
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 31

def reboot(*args); end

#requires_rosetta(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



34
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 34

def requires_rosetta(*args); end

#to_s_without_conditionalString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns caveats text excluding conditional built-in caveats. Used when serializing caveats for the JSON API so that conditional caveats (like requires_rosetta) are not pre-baked into the string.

Returns:



65
66
67
68
69
70
71
# File 'cask/dsl/caveats.rb', line 65

def to_s_without_conditional
  unconditional = @built_in_caveats.reject do |key, _|
    name = key.first
    name && CONDITIONAL_CAVEATS.include?(name)
  end
  (@custom_caveats + unconditional.values).join("\n")
end

#unsigned_accessibility(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



37
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 37

def unsigned_accessibility(*args); end

#zsh_path_helper(*args) ⇒ Symbol

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • args (T.anything)

Returns:



40
# File 'sorbet/rbi/dsl/cask/dsl/caveats.rbi', line 40

def zsh_path_helper(*args); end