Class: Cask::Cmd::Install

Inherits:
AbstractCommand show all
Defined in:
brew/Library/Homebrew/cask/cmd/install.rb

Direct Known Subclasses

Reinstall

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, run, visible

Methods included from Homebrew::Search

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

Methods included from Options

#process_arguments

Constructor Details

#initializeInstall

Returns a new instance of Install



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

def initialize(*)
  super
  raise CaskUnspecifiedError if args.empty?
end

Class Method Details

.helpObject



30
31
32
# File 'brew/Library/Homebrew/cask/cmd/install.rb', line 30

def self.help
  "installs the given Cask"
end

Instance Method Details

#runObject



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

def run
  odie "Installing casks is supported only on macOS" unless OS.mac?
  casks.each do |cask|
    begin
      Installer.new(cask, binaries:       binaries?,
                          verbose:        verbose?,
                          force:          force?,
                          skip_cask_deps: skip_cask_deps?,
                          require_sha:    require_sha?,
                          quarantine:     quarantine?).install
    rescue CaskAlreadyInstalledError => e
      opoo e.message
    end
  end
end