diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index 31cede71a9..f3d29e06d7 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 diff --git a/Library/Homebrew/cask/lib/hbc/cli/zap.rb b/Library/Homebrew/cask/lib/hbc/cli/zap.rb index 7f5e6785dc..7148bdf10c 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 diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index 4b70822eeb..b604a934f5 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 346c45d6a8..b8d229d6fb 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\.