Class: Hbc::Artifact::Pkg

Inherits:
AbstractArtifact show all
Defined in:
Library/Homebrew/cask/lib/hbc/artifact/pkg.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractArtifact

#cask, #config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractArtifact

#<=>, dirmethod, dsl_key, english_article, english_name, read_script_arguments, #to_s

Methods included from Predicable

#attr_predicate

Constructor Details

#initialize(cask, path, **stanza_options) ⇒ Pkg

Returns a new instance of Pkg



21
22
23
24
25
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 21

def initialize(cask, path, **stanza_options)
  super(cask)
  @path = cask.staged_path.join(path)
  @stanza_options = stanza_options
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path



19
20
21
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 19

def path
  @path
end

#pkg_relative_pathObject (readonly)

Returns the value of attribute pkg_relative_path



10
11
12
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 10

def pkg_relative_path
  @pkg_relative_path
end

#stanza_optionsObject (readonly)

Returns the value of attribute stanza_options



19
20
21
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 19

def stanza_options
  @stanza_options
end

Class Method Details

.from_args(cask, path, **stanza_options) ⇒ Object



12
13
14
15
16
17
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 12

def self.from_args(cask, path, **stanza_options)
  stanza_options.extend(HashValidator).assert_valid_keys(
    :allow_untrusted, :choices
  )
  new(cask, path, **stanza_options)
end

Instance Method Details

#install_phase(**options) ⇒ Object



31
32
33
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 31

def install_phase(**options)
  run_installer(**options)
end

#summarizeObject



27
28
29
# File 'Library/Homebrew/cask/lib/hbc/artifact/pkg.rb', line 27

def summarize
  path.relative_path_from(cask.staged_path).to_s
end