Class: Cask::Cmd::Install Private

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/cmd/install.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.

Implementation of the brew cask install command.

Direct Known Subclasses

Reinstall

Constant Summary collapse

OPTIONS =

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

[
  [: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?, banner_args, banner_headline, command_name, help, #initialize, max_named, run, short_description, visible?

Methods included from Homebrew::Search

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

Constructor Details

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

Class Method Details

.descriptionObject

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.


14
15
16
# File 'Library/Homebrew/cask/cmd/install.rb', line 14

def self.description
  "Installs the given <cask>."
end

.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. You should avoid using this method if possible, as it may be removed or be changed in the future.


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
74
75
76
77
78
# File 'Library/Homebrew/cask/cmd/install.rb', line 49

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

.min_namedObject

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.


10
11
12
# File 'Library/Homebrew/cask/cmd/install.rb', line 10

def self.min_named
  :cask
end

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


24
25
26
27
28
29
30
31
32
33
34
35
# File 'Library/Homebrew/cask/cmd/install.rb', line 24

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_given?
  end
end

Instance Method Details

#runObject

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.


37
38
39
40
41
42
43
44
45
46
47
# File 'Library/Homebrew/cask/cmd/install.rb', line 37

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