aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorXu Cheng2016-02-06 03:50:06 +0800
committerXu Cheng2016-02-07 15:03:17 +0800
commit2e892bcf63a1b594ddb3908bc8c82c2089cfaa45 (patch)
tree4b46b812d11ea9f4bc2445ba0862e466fd012987 /Library/Homebrew
parentf57950404b94a4c95966eb38251c55e6f2ea29dc (diff)
downloadbrew-2e892bcf63a1b594ddb3908bc8c82c2089cfaa45.tar.bz2
Tap: clear_cache for Tap#(un)install
If a tap is installed during the installation, the original cache need to be purged. Otherwise, it will return wrong information afterwards. Closes Homebrew/homebrew#48887. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/tap.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index a577d3b97..712348d60 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -65,6 +65,19 @@ class Tap
@path = TAP_DIRECTORY/"#{@user}/homebrew-#{@repo}".downcase
end
+ # clear internal cache
+ def clear_cache
+ @remote = nil
+ @formula_dir = nil
+ @formula_files = nil
+ @alias_files = nil
+ @aliases = nil
+ @alias_table = nil
+ @alias_reverse_table = nil
+ @command_files = nil
+ @formula_renames = nil
+ end
+
# The remote path to this {Tap}.
# e.g. `https://github.com/user/homebrew-repo`
def remote
@@ -129,6 +142,7 @@ class Tap
def install(options = {})
require "descriptions"
raise TapAlreadyTappedError, name if installed?
+ clear_cache
# ensure git is installed
Utils.ensure_git_installed!
@@ -200,6 +214,7 @@ class Tap
path.rmtree
path.parent.rmdir_if_possible
puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
+ clear_cache
end
def unlink_manpages