Class: Cask::Artifact::Artifact

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

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

Returns a new instance of Artifact



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

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

Class Method Details

.english_nameObject



11
12
13
# File 'brew/Library/Homebrew/cask/artifact/artifact.rb', line 11

def self.english_name
  "Generic Artifact"
end

.from_args(cask, *args) ⇒ Object

Raises:



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'brew/Library/Homebrew/cask/artifact/artifact.rb', line 15

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



29
30
31
# File 'brew/Library/Homebrew/cask/artifact/artifact.rb', line 29

def resolve_target(target)
  Pathname(target)
end