From c2ce486d3a8581d8c2fc45b0d4d0ffa7c94e75b8 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Tue, 15 Dec 2020 12:55:07 -0500 Subject: [PATCH] create: allow creating casks in a specified tap --- Library/Homebrew/dev-cmd/create.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 4cbff785d8..3815de0604 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -68,7 +68,6 @@ module Homebrew "--perl", "--python", "--ruby", "--rust", "--cask" conflicts "--cask", "--HEAD" conflicts "--cask", "--set-license" - conflicts "--cask", "--tap" named 1 end @@ -94,7 +93,11 @@ module Homebrew raise UsageError, "The `--set-name` flag is required for creating casks." end - cask_path = Cask::CaskLoader.path(token) + cask_tap = Tap.fetch(args.tap || "homebrew/cask") + raise TapUnavailableError, args.tap unless cask_tap.installed? + + cask_path = Cask::CaskLoader.path("#{cask_tap}/#{token}") + cask_path.dirname.mkpath unless cask_path.dirname.exist? raise Cask::CaskAlreadyCreatedError, token if cask_path.exist? version = if args.set_version @@ -142,7 +145,7 @@ module Homebrew fc.version = args.set_version fc.license = args.set_license fc.tap = Tap.fetch(args.tap || "homebrew/core") - raise TapUnavailableError, tap unless fc.tap.installed? + raise TapUnavailableError, args.tap unless fc.tap.installed? fc.url = args.named.first # Pull the first (and only) url from ARGV