Merge pull request #12507 from bayandin/fix-installing-from-url-exception
Fix error message duplication for installation from URL
This commit is contained in:
commit
998a4028cf
@ -45,6 +45,8 @@ class KegUnspecifiedError < UsageError
|
||||
end
|
||||
end
|
||||
|
||||
class UnsupportedInstallationMethod < RuntimeError; end
|
||||
|
||||
class MultipleVersionsInstalledError < RuntimeError; end
|
||||
|
||||
class NotAKegError < RuntimeError; end
|
||||
|
||||
@ -274,12 +274,14 @@ module Formulary
|
||||
|
||||
def load_file(flags:, ignore_errors:)
|
||||
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! " \
|
||||
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
||||
raise UnsupportedInstallationMethod,
|
||||
"Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
|
||||
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
||||
elsif url.match?(%r{^(https?|ftp)://})
|
||||
raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ",
|
||||
"`brew extract` or `brew create` and `brew tap-new` to create a "\
|
||||
"formula file in a tap on GitHub instead."
|
||||
raise UnsupportedInstallationMethod,
|
||||
"Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! " \
|
||||
"`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap " \
|
||||
"on GitHub instead."
|
||||
end
|
||||
HOMEBREW_CACHE_FORMULA.mkpath
|
||||
FileUtils.rm_f(path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user