Class: Cask::Artifact::CommandWrapper Private

Inherits:
Binary show all
Defined in:
cask/artifact/command_wrapper.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.

Artifact corresponding to the command_wrapper stanza.

Constant Summary

Constants inherited from AbstractArtifact

AbstractArtifact::DirectivesType

Instance Attribute Summary

Attributes inherited from AbstractArtifact

#cask

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Binary

#link

Methods inherited from Symlinked

english_description, link_type_english_name, #summarize_installed, #uninstall_phase

Methods included from OS::Mac::Cask::Artifact::Symlinked

#create_filesystem_link

Methods inherited from Relocated

#resolve_target, #source, #summarize, #target, #to_a

Methods included from OS::Linux::Cask::Artifact::Relocated

#add_altname_metadata

Methods inherited from AbstractArtifact

#cask_sandbox, #cask_sandbox_command, #config, dsl_key, english_article, english_name, read_script_arguments, #run_cask_sandbox, #sort_order, #staged_path_join_executable, #summarize

Methods included from Utils::Output::Mixin

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

Constructor Details

#initialize(cask, source, target:, content:) ⇒ 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:

Raises:



37
38
39
40
41
42
# File 'cask/artifact/command_wrapper.rb', line 37

def initialize(cask, source, target:, content:)
  raise CaskInvalidError.new(cask, "'command_wrapper' requires content") if content.blank?

  super(cask, source, target:)
  @content = content
end

Class Method Details

.dirmethodSymbol

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
# File 'cask/artifact/command_wrapper.rb', line 11

def self.dirmethod = :binarydir

.from_args(cask, source, options = nil) ⇒ T.attached_class

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:

  • (T.attached_class)

Raises:



20
21
22
23
24
25
26
27
# File 'cask/artifact/command_wrapper.rb', line 20

def self.from_args(cask, source, options = nil)
  options ||= {}
  options.assert_valid_keys(:target, :content)
  raise CaskInvalidError.new(cask, "'command_wrapper' requires target") unless options.key?(:target)
  raise CaskInvalidError.new(cask, "'command_wrapper' requires content") unless options.key?(:content)

  new(cask, source, **options)
end

Instance Method Details

#install_phase(force: false, adopt: false, command: SystemCommand, **options) ⇒ 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:

  • force (Boolean) (defaults to: false)
  • adopt (Boolean) (defaults to: false)
  • command (T.class_of(SystemCommand)) (defaults to: SystemCommand)
  • options (T.anything)


52
53
54
55
56
# File 'cask/artifact/command_wrapper.rb', line 52

def install_phase(force: false, adopt: false, command: SystemCommand, **options)
  source.dirname.mkpath
  source.write(@content)
  super
end

#to_argsArray<T.anything>

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:



59
60
61
# File 'cask/artifact/command_wrapper.rb', line 59

def to_args
  [@source_string, { target: @target_string, content: @content }]
end