From d62029f899afacf86f5bf36669251eb2e3421418 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 7 Sep 2016 23:04:49 +0100 Subject: [PATCH] Explain Tab.create vs Tab.for_formula This was really confusing to me, and I had to go looking through the Tab history, where I found a comment explaining it that has since been deleted. This wasn't a great experience. This commit basically adds that explanation back in. --- Library/Homebrew/tab.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index cf398fcbfa..2c3484f42f 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -16,6 +16,7 @@ class Tab < OpenStruct CACHE.clear end + # Instantiates a Tab for a new installation of a formula. def self.create(formula, compiler, stdlib) build = formula.build attributes = { @@ -110,6 +111,8 @@ class Tab < OpenStruct options end + # Returns a Tab for an already installed formula, + # or a fake one if the formula is not installed. def self.for_formula(f) paths = [] @@ -134,6 +137,7 @@ class Tab < OpenStruct used_options = remap_deprecated_options(f.deprecated_options, tab.used_options) tab.used_options = used_options.as_flags else + # Formula is not installed. Return a fake tab. tab = empty tab.unused_options = f.options.as_flags tab.source = {