Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove cask/cmd/install #15273

Merged
merged 4 commits into from Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion Library/Homebrew/cask.rb
Expand Up @@ -8,7 +8,6 @@
require "cask/cask_loader"
require "cask/cask"
require "cask/caskroom"
require "cask/cmd"
require "cask/config"
require "cask/exceptions"
require "cask/denylist"
Expand Down
32 changes: 0 additions & 32 deletions Library/Homebrew/cask/cmd.rb

This file was deleted.

98 changes: 0 additions & 98 deletions Library/Homebrew/cask/cmd/abstract_command.rb

This file was deleted.

116 changes: 0 additions & 116 deletions Library/Homebrew/cask/cmd/install.rb

This file was deleted.

75 changes: 59 additions & 16 deletions Library/Homebrew/cmd/install.rb
Expand Up @@ -2,8 +2,8 @@
# frozen_string_literal: true

require "cask/config"
require "cask/cmd"
require "cask/cmd/install"
require "cask/installer"
require "cask_dependent"
require "missing_formula"
require "formula_installer"
require "development_tools"
Expand Down Expand Up @@ -127,8 +127,29 @@ def self.install_args
formula_options
[
[:switch, "--cask", "--casks", { description: "Treat all named arguments as casks." }],
*Cask::Cmd::AbstractCommand::OPTIONS.map(&:dup),
*Cask::Cmd::Install::OPTIONS.map(&:dup),
[:switch, "--[no-]binaries", {
description: "Disable/enable linking of helper executables (default: enabled).",
env: :cask_opts_binaries,
}],
[:switch, "--require-sha", {
description: "Require all casks to have a checksum.",
env: :cask_opts_require_sha,
}],
[:switch, "--[no-]quarantine", {
description: "Disable/enable quarantining of downloads (default: enabled).",
env: :cask_opts_quarantine,
}],
[:switch, "--adopt", {
description: "Adopt existing artifacts in the destination that are identical to those being installed. " \
"Cannot be combined with --force.",
}],
[:switch, "--skip-cask-deps", {
description: "Skip installing cask dependencies.",
}],
[:switch, "--zap", {
description: "For use with `brew reinstall --cask`. Remove all files associated with a cask. " \
"*May remove files which are shared between applications.*",
}],
].each do |args|
options = args.pop
send(*args, **options)
Expand Down Expand Up @@ -183,18 +204,40 @@ def self.install
end

if casks.any?
Cask::Cmd::Install.install_casks(
*casks,
binaries: args.binaries?,
verbose: args.verbose?,
force: args.force?,
adopt: args.adopt?,
require_sha: args.require_sha?,
skip_cask_deps: args.skip_cask_deps?,
quarantine: args.quarantine?,
quiet: args.quiet?,
dry_run: args.dry_run?,
)

if args.dry_run?
if (casks_to_install = casks.reject(&:installed?).presence)
ohai "Would install #{::Utils.pluralize("cask", casks_to_install.count, include_count: true)}:"
puts casks_to_install.map(&:full_name).join(" ")
end
casks.each do |cask|
dep_names = CaskDependent.new(cask)
.runtime_dependencies
.reject(&:installed?)
.map(&:to_formula)
.map(&:name)
next if dep_names.blank?

ohai "Would install #{::Utils.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y",
include_count: true)} for #{cask.full_name}:"
puts dep_names.join(" ")
end
return
end

require "cask/installer"

casks.each do |cask|
Cask::Installer.new(cask,
binaries: args.binaries?,
verbose: args.verbose?,
force: args.force?,
adopt: args.adopt?,
require_sha: args.require_sha?,
skip_cask_deps: args.skip_cask_deps?,
quarantine: args.quarantine?,
quiet: args.quiet?).install
end
end

# if the user's flags will prevent bottle only-installations when no
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cmd/outdated.rb
Expand Up @@ -4,7 +4,6 @@
require "formula"
require "keg"
require "cli/parser"
require "cask/cmd"
require "cask/caskroom"
require "api"

Expand Down