aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formulary.rb
diff options
context:
space:
mode:
authorXu Cheng2015-10-09 15:27:59 +0800
committerXu Cheng2015-10-10 01:34:36 +0800
commit60ba8beefadedee7db03cb35b1fd24f2be6eeed5 (patch)
tree0aa2b36261e2d7a76b01834b0c193feab131c145 /Library/Homebrew/formulary.rb
parent5b321ffb5a5308f1de96e7bfa79e83828e9c9552 (diff)
downloadbrew-60ba8beefadedee7db03cb35b1fd24f2be6eeed5.tar.bz2
Formulary.from_rack: better formula resolution strategy
The flow is as follow: * If tap is nil(DIY install), search using name. * If tap is found, search using full name. * If tap is found and full name searching failed, search using name. This usually means the formula may be migrated to different tap. Closes Homebrew/homebrew#44771. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/formulary.rb')
-rw-r--r--Library/Homebrew/formulary.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 2bdaca752..7577edb9e 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -217,10 +217,15 @@ class Formulary
tap = tab.tap
spec ||= tab.spec
- if tap.nil? || tap == "Homebrew/homebrew"
+ if tap.nil?
factory(rack.basename.to_s, spec)
else
- factory("#{tap.sub("homebrew-", "")}/#{rack.basename}", spec)
+ begin
+ factory("#{tap}/#{rack.basename}", spec)
+ rescue FormulaUnavailableError
+ # formula may be migrated to different tap. Try to search in core and all taps.
+ factory(rack.basename.to_s, spec)
+ end
end
end