Class: Hbc::CLI::Install

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/lib/hbc/cli/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 Options

included, #process_arguments

Constructor Details

#initializeInstall

Returns a new instance of Install



7
8
9
10
# File 'Library/Homebrew/cask/lib/hbc/cli/install.rb', line 7

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

Class Method Details

.helpObject



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

def self.help
  "installs the given Cask"
end

.needs_init?Boolean

Returns:

  • (Boolean)


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

def self.needs_init?
  true
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'Library/Homebrew/cask/lib/hbc/cli/install.rb', line 12

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?).install
    rescue CaskAlreadyInstalledError => e
      opoo e.message
    end
  end
end