Class: Cask::Artifact::AbstractFlightBlock Private

Inherits:
AbstractArtifact show all
Defined in:
cask/artifact/abstract_flight_block.rb

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.

Abstract superclass for block artifacts.

Direct Known Subclasses

PostflightBlock, PreflightBlock

Constant Summary

Constants inherited from AbstractArtifact

Cask::Artifact::AbstractArtifact::DirectivesType

Instance Attribute Summary collapse

Attributes inherited from AbstractArtifact

#cask

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractArtifact

#cask_sandbox, #config, dirmethod, english_article, english_name, read_script_arguments, #requires_sudo?, #run_cask_sandbox, #sort_order, #staged_path_join_executable, #to_args

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Constructor Details

#initialize(cask, **directives) ⇒ 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:



24
25
26
27
# File 'cask/artifact/abstract_flight_block.rb', line 24

def initialize(cask, **directives)
  super(cask)
  @directives = directives
end

Instance Attribute Details

#directives ⇒ Hash{Symbol => DirectivesType} (readonly)

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:



21
22
23
# File 'cask/artifact/abstract_flight_block.rb', line 21

def directives
  @directives
end

Class Method Details

.class_for_dsl_key(dsl_key) ⇒ T::Class[::Cask::DSL::Base]

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:



66
67
68
69
70
71
72
# File 'cask/artifact/abstract_flight_block.rb', line 66

def self.class_for_dsl_key(dsl_key)
  namespace = name.to_s.sub(/::.*::.*$/, "")
  # The DSL class name is derived dynamically from the flight block's key.
  # rubocop:disable Sorbet/ConstantsFromStrings
  const_get("#{namespace}::DSL::#{dsl_key.to_s.split("_").map(&:capitalize).join}")
  # rubocop:enable Sorbet/ConstantsFromStrings
end

.dsl_key ⇒ 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:



11
12
13
# File 'cask/artifact/abstract_flight_block.rb', line 11

def self.dsl_key
  super.to_s.sub(/_block$/, "").to_sym
end

.uninstall_dsl_key ⇒ 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:



16
17
18
# File 'cask/artifact/abstract_flight_block.rb', line 16

def self.uninstall_dsl_key
  :"uninstall_#{dsl_key}"
end

Instance Method Details

#install_phase(adopt: false, auto_updates: false, force: false, verbose: false, predecessor: nil, command: SystemCommand) ⇒ 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:

  • adopt (Boolean) (defaults to: false)
  • auto_updates (Boolean, nil) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • predecessor (Cask, nil) (defaults to: nil)
  • command (T.class_of(SystemCommand)) (defaults to: SystemCommand)


39
40
41
42
# File 'cask/artifact/abstract_flight_block.rb', line 39

def install_phase(adopt: false, auto_updates: false, force: false, verbose: false, predecessor: nil,
                  command: SystemCommand)
  abstract_phase(self.class.dsl_key)
end

#summarize ⇒ String

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:



61
62
63
# File 'cask/artifact/abstract_flight_block.rb', line 61

def summarize
  directives.keys.join(", ")
end

#uninstall_phase(skip: false, force: false, verbose: false, successor: nil, upgrade: false, reinstall: false, command: SystemCommand) ⇒ 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:

  • skip (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • successor (Cask, nil) (defaults to: nil)
  • upgrade (Boolean) (defaults to: false)
  • reinstall (Boolean) (defaults to: false)
  • command (T.class_of(SystemCommand)) (defaults to: SystemCommand)


55
56
57
58
# File 'cask/artifact/abstract_flight_block.rb', line 55

def uninstall_phase(skip: false, force: false, verbose: false, successor: nil, upgrade: false,
                    reinstall: false, command: SystemCommand)
  abstract_phase(self.class.uninstall_dsl_key)
end