aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-04-02 17:29:40 +0100
committerGitHub2017-04-02 17:29:40 +0100
commita47c93fe2df4c313faca397dc8f6d4296efe7b7d (patch)
tree8f37a5f17899d33afc2ca0c55585a93cd87d5adf
parent9b5d1edc4522ae81ff6173c91aff522dc27a77c9 (diff)
parent879b3360d3c664750dd90571f898c349e21442fb (diff)
downloadbrew-a47c93fe2df4c313faca397dc8f6d4296efe7b7d.tar.bz2
Merge pull request #2441 from MikeMcQuaid/install-handle-missing-receipt
Handle missing receipt on `brew install`.
-rw-r--r--Library/Homebrew/cmd/install.rb6
-rw-r--r--Library/Homebrew/tab.rb5
-rw-r--r--Library/Homebrew/test/tab_spec.rb2
3 files changed, 9 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index a32f2ef34..1808c4d9c 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -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
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index fd59539df..db4b1c585 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -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,
diff --git a/Library/Homebrew/test/tab_spec.rb b/Library/Homebrew/test/tab_spec.rb
index fec390c28..1b0836c93 100644
--- a/Library/Homebrew/test/tab_spec.rb
+++ b/Library/Homebrew/test/tab_spec.rb
@@ -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