49 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-09-06 08:29:14 +02:00
module Cask
2018-09-04 08:45:48 +01:00
class Cmd
2017-05-20 19:08:03 +02:00
class Install < AbstractCommand
2020-08-01 02:30:46 +02:00
def self.min_named
:cask
end
def self.description
"Installs the given <cask>."
end
2017-05-21 00:15:56 +02:00
2020-08-01 02:30:46 +02:00
def self.parser(&block)
super do
switch "--force",
description: "Force overwriting existing files."
switch "--skip-cask-deps",
description: "Skip installing cask dependencies."
instance_eval(&block) if block_given?
end
2017-05-20 02:27:13 +02:00
end
def run
2020-08-18 00:23:23 +01:00
require "cask/installer"
2020-08-01 02:30:46 +02:00
options = {
binaries: args.binaries?,
verbose: args.verbose?,
force: args.force?,
skip_cask_deps: args.skip_cask_deps?,
require_sha: args.require_sha?,
quarantine: args.quarantine?,
}.compact
options[:quarantine] = true if options[:quarantine].nil?
odie "Installing casks is supported only on macOS" unless OS.mac?
casks.each do |cask|
2020-08-01 02:30:46 +02:00
Installer.new(cask, **options).install
rescue CaskAlreadyInstalledError => e
opoo e.message
2016-09-24 13:52:43 +02:00
end
end
end
2016-08-18 22:11:42 +03:00
end
end