Merge pull request #2441 from MikeMcQuaid/install-handle-missing-receipt

Handle missing receipt on `brew install`.
This commit is contained in:
Mike McQuaid 2017-04-02 17:29:40 +01:00 committed by GitHub
commit a47c93fe2d
3 changed files with 9 additions and 4 deletions

View File

@ -194,8 +194,10 @@ module Homebrew
next unless f.opt_prefix.directory?
keg = Keg.new(f.opt_prefix.resolved_path)
tab = Tab.for_keg(keg)
tab.installed_on_request = true
tab.write
unless tab.installed_on_request
tab.installed_on_request = true
tab.write
end
end
perform_preinstall_checks

View File

@ -100,11 +100,14 @@ class Tab < OpenStruct
def self.for_keg(keg)
path = keg.join(FILENAME)
if path.exist?
tab = if path.exist?
from_file(path)
else
empty
end
tab["tabfile"] = path
tab
end
# Returns a tab for the named formula's installation,

View File

@ -258,7 +258,7 @@ describe Tab do
it "can create a Tab for a non-existant Keg" do
f.prefix.mkpath
expect(subject.tabfile).to be nil
expect(subject.tabfile).to eq(f_tab_path)
end
end