aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/installer.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-08-20 17:50:54 +0200
committerGitHub2017-08-20 17:50:54 +0200
commit4b34ca5b35b095e538b6e3bfe642eb57dad924ee (patch)
treecaa848ae38b83e9055427d7e09625e0d5b98cda9 /Library/Homebrew/cask/lib/hbc/installer.rb
parent5b965d6a79fcf47d5abcb6006de84fddb558328b (diff)
parentf89e09b7857e8e3a6f6cd30258aa5927a1ac2872 (diff)
downloadbrew-4b34ca5b35b095e538b6e3bfe642eb57dad924ee.tar.bz2
Merge pull request #3001 from reitermarkus/cask-conflicts-with
Implement `conflicts_with :cask`.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/installer.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 53210ed4b..37cc4e561 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -86,6 +86,8 @@ module Hbc
raise CaskAlreadyInstalledError, @cask
end
+ check_conflicts
+
print_caveats
fetch
uninstall_existing_cask if @reinstall
@@ -98,6 +100,21 @@ module Hbc
puts summary
end
+ def check_conflicts
+ return unless @cask.conflicts_with
+
+ @cask.conflicts_with.cask.each do |conflicting_cask|
+ begin
+ conflicting_cask = CaskLoader.load(conflicting_cask)
+ if conflicting_cask.installed?
+ raise CaskConflictError.new(@cask, conflicting_cask)
+ end
+ rescue CaskUnavailableError
+ next # Ignore conflicting Casks that do not exist.
+ end
+ end
+ end
+
def reinstall
odebug "Hbc::Installer#reinstall"
@reinstall = true