Class: Cask::Artifact::Artifact Private

Inherits:
Moved show all
Defined in:
Library/Homebrew/cask/artifact/artifact.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Generic artifact corresponding to the artifact stanza.

Instance Attribute Summary

Attributes inherited from Relocated

#source, #target

Attributes inherited from AbstractArtifact

#cask

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Moved

english_description, #install_phase, #summarize_installed, #uninstall_phase

Methods inherited from Relocated

#summarize, #to_a

Methods inherited from AbstractArtifact

#<=>, #config, dirmethod, dsl_key, english_article, read_script_arguments, #staged_path_join_executable, #to_s

Methods included from Predicable

#attr_predicate

Constructor Details

#initialize(cask, source, target: nil) ⇒ Artifact

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Artifact.


37
38
39
# File 'Library/Homebrew/cask/artifact/artifact.rb', line 37

def initialize(cask, source, target: nil)
  super(cask, source, target: target)
end

Class Method Details

.english_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


15
16
17
# File 'Library/Homebrew/cask/artifact/artifact.rb', line 15

def self.english_name
  "Generic Artifact"
end

.from_args(cask, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'Library/Homebrew/cask/artifact/artifact.rb', line 19

def self.from_args(cask, *args)
  source_string, target_hash = args

  raise CaskInvalidError.new(cask.token, "no source given for #{english_name}") if source_string.nil?

  unless target_hash.is_a?(Hash)
    raise CaskInvalidError.new(cask.token, "target required for #{english_name} '#{source_string}'")
  end

  target_hash.assert_valid_keys!(:target)

  new(cask, source_string, **target_hash)
end

Instance Method Details

#resolve_target(target) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


33
34
35
# File 'Library/Homebrew/cask/artifact/artifact.rb', line 33

def resolve_target(target)
  Pathname(target)
end