Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Library/Homebrew/cask/cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require "cask/cmd/abstract_command"
require "cask/cmd/audit"
require "cask/cmd/install"
require "cask/cmd/reinstall"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not many to go 🎉


module Cask
# Implementation of the `brew cask` command-line interface.
Expand Down
56 changes: 0 additions & 56 deletions Library/Homebrew/cask/cmd/reinstall.rb

This file was deleted.

34 changes: 34 additions & 0 deletions Library/Homebrew/cask/reinstall.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: true
# frozen_string_literal: true

module Cask
#
# @api private
class Reinstall
def self.reinstall_casks(
*casks,
verbose: nil,
force: nil,
skip_cask_deps: nil,
binaries: nil,
require_sha: nil,
quarantine: nil,
zap: nil
)
require "cask/installer"

quarantine = true if quarantine.nil?

casks.each do |cask|
Installer.new(cask,
binaries: binaries,
verbose: verbose,
force: force,
skip_cask_deps: skip_cask_deps,
require_sha: require_sha,
quarantine: quarantine,
zap: zap).reinstall
end
end
end
end
3 changes: 2 additions & 1 deletion Library/Homebrew/cmd/reinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require "cask/cmd"
require "cask/utils"
require "cask/macos"
require "cask/reinstall"
require "upgrade"
require "api"

Expand Down Expand Up @@ -150,7 +151,7 @@ def reinstall
)

if casks.any?
Cask::Cmd::Reinstall.reinstall_casks(
Cask::Reinstall.reinstall_casks(
*casks,
binaries: args.binaries?,
verbose: args.verbose?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# typed: false
# frozen_string_literal: true

describe Cask::Cmd::Reinstall, :cask do
require "cask/installer"
require "cask/reinstall"

describe Cask::Reinstall, :cask do
it "displays the reinstallation progress" do
caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))

Expand All @@ -20,7 +23,7 @@
EOS

expect do
described_class.run("local-caffeine")
described_class.reinstall_casks(Cask::CaskLoader.load("local-caffeine"))
end.to output(output).to_stdout
end

Expand All @@ -45,7 +48,7 @@
EOS

expect do
described_class.run("local-caffeine", "--zap")
described_class.reinstall_casks(Cask::CaskLoader.load("local-caffeine"), zap: true)
end.to output(output).to_stdout
end

Expand All @@ -54,14 +57,14 @@

expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed

described_class.run("local-transmission")
described_class.reinstall_casks(Cask::CaskLoader.load("local-transmission"))
expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed
end

it "allows reinstalling a non installed Cask" do
expect(Cask::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed

described_class.run("local-transmission")
described_class.reinstall_casks(Cask::CaskLoader.load("local-transmission"))
expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed
end
end