Merge pull request #4545 from reitermarkus/tap-path-regex
Make `HOMEBREW_TAP_PATH_REGEX` also match exact path.
This commit is contained in:
commit
478f50f589
@ -5,6 +5,6 @@ HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}
|
|||||||
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
|
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
|
||||||
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}
|
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}
|
||||||
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
|
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
|
||||||
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{/(.*)}.source)
|
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
|
||||||
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
||||||
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}
|
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}
|
||||||
|
|||||||
@ -82,6 +82,20 @@ describe Tap do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "::from_path" do
|
||||||
|
let(:tap) { described_class.fetch("Homebrew", "core") }
|
||||||
|
let(:path) { tap.path }
|
||||||
|
let(:formula_path) { path/"Formula/formula.rb" }
|
||||||
|
|
||||||
|
it "returns the Tap for a Formula path" do
|
||||||
|
expect(described_class.from_path(formula_path)).to eq tap
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns the Tap when given its exact path" do
|
||||||
|
expect(described_class.from_path(path)).to eq tap
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
specify "::names" do
|
specify "::names" do
|
||||||
expect(described_class.names.sort).to eq(["homebrew/core", "homebrew/foo"])
|
expect(described_class.names.sort).to eq(["homebrew/core", "homebrew/foo"])
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user