Merge pull request #20475 from Homebrew/better_formulary_debugging
formulary: provide ref and realpath when rejecting path.
This commit is contained in:
commit
523d743705
@ -619,12 +619,13 @@ module Formulary
|
||||
if Homebrew::EnvConfig.forbid_packages_from_paths?
|
||||
path_realpath = path.realpath.to_s
|
||||
path_string = path.to_s
|
||||
if !path_realpath.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/", "#{HOMEBREW_CACHE}/") &&
|
||||
if (path_realpath.end_with?(".rb") || path_string.end_with?(".rb")) &&
|
||||
!path_realpath.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/", "#{HOMEBREW_CACHE}/") &&
|
||||
!path_string.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/", "#{HOMEBREW_CACHE}/")
|
||||
if path_string.include?("./") || path_string.end_with?(".rb") || path_string.count("/") != 2
|
||||
raise <<~WARNING
|
||||
Rejecting formula at #{path_string} because it's not in a tap.
|
||||
Homebrew requires formulae to be in a tap.
|
||||
Homebrew requires formulae to be in a tap, rejecting:
|
||||
#{path_string} (#{path_realpath})
|
||||
|
||||
To create a tap, run e.g.
|
||||
brew tap-new <user|org>/<repository>
|
||||
|
||||
@ -126,7 +126,7 @@ RSpec.describe Formulary do
|
||||
described_class.factory(temp_formula_path)
|
||||
ensure
|
||||
temp_formula_path.unlink
|
||||
end.to raise_error(RuntimeError, /Rejecting formula at/)
|
||||
end.to raise_error(RuntimeError, /requires formulae to be in a tap, rejecting/)
|
||||
end
|
||||
|
||||
it "returns a Formula when given a URL", :needs_utils_curl do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user