Class: Cask::Artifact::Installer Private
- Inherits:
-
AbstractArtifact
- Object
- AbstractArtifact
- Cask::Artifact::Installer
- Defined in:
- cask/artifact/installer.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 installer
stanza.
Defined Under Namespace
Modules: ManualInstaller, ScriptInstaller
Constant Summary collapse
- VALID_KEYS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
Set.new([ :manual, :script, ]).freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
private
-
#path ⇒ Object
readonly
private
Attributes inherited from AbstractArtifact
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cask, **args) ⇒ Installer
constructor
private
A new instance of Installer.
-
#summarize ⇒ Object
private
-
#to_h ⇒ Object
private
Methods inherited from AbstractArtifact
#<=>, #config, dirmethod, dsl_key, english_article, english_name, read_script_arguments, #staged_path_join_executable, #to_args, #to_s
Methods included from Predicable
Constructor Details
#initialize(cask, **args) ⇒ Installer
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 a new instance of Installer.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'cask/artifact/installer.rb', line 72 def initialize(cask, **args) super(cask, **args) if args.key?(:manual) @path = Pathname(args[:manual]) @args = [] extend(ManualInstaller) return end path, @args = self.class.read_script_arguments( args[:script], self.class.dsl_key.to_s, { must_succeed: true, sudo: false }, print_stdout: true ) raise CaskInvalidError.new(cask, "#{self.class.dsl_key} missing executable") if path.nil? @path = Pathname(path) extend(ScriptInstaller) end |
Instance Attribute Details
#args ⇒ Object (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.
70 71 72 |
# File 'cask/artifact/installer.rb', line 70 def args @args end |
#path ⇒ Object (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.
70 71 72 |
# File 'cask/artifact/installer.rb', line 70 def path @path end |
Class Method Details
.from_args(cask, **args) ⇒ Object
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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'cask/artifact/installer.rb', line 46 def self.from_args(cask, **args) raise CaskInvalidError.new(cask, "'installer' stanza requires an argument.") if args.empty? if args.key?(:script) && !args[:script].respond_to?(:key?) if args.key?(:executable) raise CaskInvalidError.new(cask, "'installer' stanza gave arguments for both :script and :executable.") end args[:executable] = args[:script] args.delete(:script) args = { script: args } end if args.keys.count != 1 raise CaskInvalidError.new( cask, "invalid 'installer' stanza: Only one of #{VALID_KEYS.inspect} is permitted.", ) end args.assert_valid_keys(*VALID_KEYS) new(cask, **args) end |
Instance Method Details
#summarize ⇒ Object
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.
91 92 93 |
# File 'cask/artifact/installer.rb', line 91 def summarize path.to_s end |
#to_h ⇒ Object
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.
95 96 97 98 99 |
# File 'cask/artifact/installer.rb', line 95 def to_h { path: path }.tap do |h| h[:args] = args unless is_a?(ManualInstaller) end end |