From 7a0622ea9ea45b56cb38469b746121e156a0d7a9 Mon Sep 17 00:00:00 2001 From: commitay Date: Sat, 28 Apr 2018 19:17:28 +1000 Subject: [PATCH 1/3] Fix `zap --force` for uninstalled casks --- Library/Homebrew/cask/lib/hbc/artifact/moved.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index 31cede71a..f3d29e06d 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -58,7 +58,7 @@ module Hbc end unless target.exist? - return if skip + return if skip || force raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there." end From 18cd7b7b4be8c2b99bc5185e37028c57647756f0 Mon Sep 17 00:00:00 2001 From: commitay Date: Sat, 28 Apr 2018 20:12:55 +1000 Subject: [PATCH 2/3] zap: CaskNotInstalledError --- Library/Homebrew/cask/lib/hbc/cli/zap.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/cask/lib/hbc/cli/zap.rb b/Library/Homebrew/cask/lib/hbc/cli/zap.rb index 7f5e6785d..7148bdf10 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/zap.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/zap.rb @@ -11,6 +11,9 @@ module Hbc def run casks.each do |cask| odebug "Zapping Cask #{cask}" + + raise CaskNotInstalledError, cask unless cask.installed? || force? + Installer.new(cask, verbose: verbose?, force: force?).zap end end From fd84c4c40c75dd0ef723fcbff6f1f8033b5c139d Mon Sep 17 00:00:00 2001 From: commitay Date: Sat, 28 Apr 2018 20:34:55 +1000 Subject: [PATCH 3/3] zap: update manpage --- Library/Homebrew/manpages/brew-cask.1.md | 6 +++--- manpages/brew-cask.1 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index 4b70822ee..b604a934f 100644 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ b/Library/Homebrew/manpages/brew-cask.1.md @@ -123,11 +123,11 @@ names, and other aspects of this manual are still subject to change. If `--greedy` is given then also upgrade the Casks having `auto_updates true` or `version :latest`. - * `zap` [ ... ]: + * `zap` [--force] [ ... ]: Unconditionally remove _all_ files associated with the given Cask. + With `--force`, zap even if the Cask does not appear to be currently installed. - Implicitly performs all actions associated with `uninstall`, even if - the Cask does not appear to be currently installed. + Implicitly performs all actions associated with `uninstall`. Removes all staged versions of the Cask distribution found under `/`. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 346c45d6a..b8d229d6f 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -118,11 +118,11 @@ Uninstall the given Cask\. With \fB\-\-force\fR, uninstall even if the Cask does Without token arguments, upgrade all the installed Casks that have newer versions available in the tap; otherwise update the tokens given in the command line\. If \fB\-\-greedy\fR is given then also upgrade the Casks having \fBauto_updates true\fR or \fBversion :latest\fR\. . .TP -\fBzap\fR \fItoken\fR [ \fItoken\fR \.\.\. ] -Unconditionally remove \fIall\fR files associated with the given Cask\. +\fBzap\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ] +Unconditionally remove \fIall\fR files associated with the given Cask\. With \fB\-\-force\fR, zap even if the Cask does not appear to be currently installed\. . .IP -Implicitly performs all actions associated with \fBuninstall\fR, even if the Cask does not appear to be currently installed\. +Implicitly performs all actions associated with \fBuninstall\fR\. . .IP Removes all staged versions of the Cask distribution found under \fB/\fR\fItoken\fR\.