homebrew-cask-versions/lib/cask/cli/uninstall.rb
Paul Hinze a89494860a check for cask before unlinking during uninstall
this was exposed in #313 by @vitorgalvao in his attempt to update the
anvil cask; by adding a link to that cask, (which just so happens to be
the cask that we chose for our "already uninstalled message" test).

the fix is simply to move the "already uninstalled" check *before* we
start to unlink.
2013-05-12 19:55:30 -05:00

18 lines
428 B
Ruby

class Cask::CLI::Uninstall
def self.run(*cask_names)
begin
casks = cask_names.map { |cn| Cask.load(cn) }
casks.each do |cask|
raise CaskNotInstalledError.new(cask) unless cask.installed?
Cask::AppLinker.new(cask).unlink
Cask::Installer.uninstall(cask)
end
rescue CaskError => e
onoe e
end
end
def self.help
"uninstalls the cask of the given name"
end
end