create: allow creating casks in a specified tap

This commit is contained in:
EricFromCanada 2020-12-15 12:55:07 -05:00
parent fbe09104b9
commit c2ce486d3a

View File

@ -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