Class: Cask::Cmd::Install Private

Inherits:
AbstractCommand show all
Extended by:
T::Sig
Defined in:
cask/cmd/install.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.

Cask implementation of the brew install command.

Direct Known Subclasses

Reinstall

Constant Summary collapse

OPTIONS =

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.

[
  [:switch, "--skip-cask-deps", {
    description: "Skip installing cask dependencies.",
  }],
].freeze

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, help, #initialize, run, short_description, visible?

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Methods included from Homebrew::Search::Extension

#search_casks, #search_descriptions

Constructor Details

This class inherits a constructor from Cask::Cmd::AbstractCommand

Class Method Details

.install_casks(*casks, verbose: nil, force: nil, binaries: nil, skip_cask_deps: nil, require_sha: nil, quarantine: nil) ⇒ 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.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'cask/cmd/install.rb', line 44

def self.install_casks(
  *casks,
  verbose: nil,
  force: nil,
  binaries: nil,
  skip_cask_deps: nil,
  require_sha: nil,
  quarantine: nil
)
  odie "Installing casks is supported only on macOS" unless OS.mac?

  options = {
    verbose:        verbose,
    force:          force,
    binaries:       binaries,
    skip_cask_deps: skip_cask_deps,
    require_sha:    require_sha,
    quarantine:     quarantine,
  }.compact

  options[:quarantine] = true if options[:quarantine].nil?

  require "cask/installer"

  casks.each do |cask|
    Installer.new(cask, **options).install
  rescue CaskAlreadyInstalledError => e
    opoo e.message
  end
end

.parser(&block) ⇒ 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.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'cask/cmd/install.rb', line 18

def self.parser(&block)
  super do
    switch "--force",
           description: "Force overwriting existing files."

    OPTIONS.each do |option|
      send(*option)
    end

    instance_eval(&block) if block
  end
end

Instance Method Details

#runvoid

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.



32
33
34
35
36
37
38
39
40
41
42
# File 'cask/cmd/install.rb', line 32

def run
  self.class.install_casks(
    *casks,
    binaries:       args.binaries?,
    verbose:        args.verbose?,
    force:          args.force?,
    skip_cask_deps: args.skip_cask_deps?,
    require_sha:    args.require_sha?,
    quarantine:     args.quarantine?,
  )
end