mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Only use HOMEBREW_TAP_PATH_REGEX
once inside Tap
class.
This commit is contained in:
parent
db2cd52842
commit
94f2098c36
@ -97,14 +97,14 @@ module Hbc
|
||||
|
||||
class FromTapPathLoader < FromPathLoader
|
||||
def self.can_load?(ref)
|
||||
File.expand_path(ref).match?(HOMEBREW_TAP_PATH_REGEX) && super
|
||||
super && !Tap.from_path(ref).nil?
|
||||
end
|
||||
|
||||
attr_reader :tap
|
||||
|
||||
def initialize(tap_path)
|
||||
@tap = Tap.from_path(File.expand_path(tap_path))
|
||||
super tap_path
|
||||
def initialize(path)
|
||||
@tap = Tap.from_path(path)
|
||||
super(path)
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -181,8 +181,7 @@ class TapFormulaAmbiguityError < RuntimeError
|
||||
@name = name
|
||||
@paths = paths
|
||||
@formulae = paths.map do |path|
|
||||
match = path.to_s.match(HOMEBREW_TAP_PATH_REGEX)
|
||||
"#{Tap.fetch(match[:user], match[:repo])}/#{path.basename(".rb")}"
|
||||
"#{Tap.from_path(path).name}/#{path.basename(".rb")}"
|
||||
end
|
||||
|
||||
super <<~EOS
|
||||
|
@ -179,8 +179,8 @@ class Formula
|
||||
|
||||
@tap = if path == Formulary.core_path(name)
|
||||
CoreTap.instance
|
||||
elsif match = path.to_s.match(HOMEBREW_TAP_PATH_REGEX)
|
||||
Tap.fetch(match[:user], match[:repo])
|
||||
else
|
||||
Tap.from_path(path)
|
||||
end
|
||||
|
||||
@full_name = full_name_with_optional_tap(name)
|
||||
|
@ -39,7 +39,7 @@ class Tap
|
||||
end
|
||||
|
||||
def self.from_path(path)
|
||||
match = path.to_s.match(HOMEBREW_TAP_PATH_REGEX)
|
||||
match = File.expand_path(path).match(HOMEBREW_TAP_PATH_REGEX)
|
||||
raise "Invalid tap path '#{path}'" unless match
|
||||
fetch(match[:user], match[:repo])
|
||||
rescue
|
||||
|
Loading…
x
Reference in New Issue
Block a user