Fix error message duplication for installation from URL
This commit is contained in:
parent
120dab2816
commit
7fb74cb1dc
@ -45,6 +45,8 @@ class KegUnspecifiedError < UsageError
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class UnsupportedInstallationMethod < RuntimeError; end
|
||||||
|
|
||||||
class MultipleVersionsInstalledError < RuntimeError; end
|
class MultipleVersionsInstalledError < RuntimeError; end
|
||||||
|
|
||||||
class NotAKegError < RuntimeError; end
|
class NotAKegError < RuntimeError; end
|
||||||
|
|||||||
@ -274,12 +274,14 @@ module Formulary
|
|||||||
|
|
||||||
def load_file(flags:, ignore_errors:)
|
def load_file(flags:, ignore_errors:)
|
||||||
if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url
|
if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url
|
||||||
raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
|
raise UnsupportedInstallationMethod,
|
||||||
|
"Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
|
||||||
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
||||||
elsif url.match?(%r{^(https?|ftp)://})
|
elsif url.match?(%r{^(https?|ftp)://})
|
||||||
raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ",
|
raise UnsupportedInstallationMethod,
|
||||||
"`brew extract` or `brew create` and `brew tap-new` to create a "\
|
"Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! " \
|
||||||
"formula file in a tap on GitHub instead."
|
"`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap " \
|
||||||
|
"on GitHub instead."
|
||||||
end
|
end
|
||||||
HOMEBREW_CACHE_FORMULA.mkpath
|
HOMEBREW_CACHE_FORMULA.mkpath
|
||||||
FileUtils.rm_f(path)
|
FileUtils.rm_f(path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user