mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
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>
This commit is contained in:
parent
f57950404b
commit
2e892bcf63
@ -65,6 +65,19 @@ class Tap
|
|||||||
@path = TAP_DIRECTORY/"#{@user}/homebrew-#{@repo}".downcase
|
@path = TAP_DIRECTORY/"#{@user}/homebrew-#{@repo}".downcase
|
||||||
end
|
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}.
|
# The remote path to this {Tap}.
|
||||||
# e.g. `https://github.com/user/homebrew-repo`
|
# e.g. `https://github.com/user/homebrew-repo`
|
||||||
def remote
|
def remote
|
||||||
@ -129,6 +142,7 @@ class Tap
|
|||||||
def install(options = {})
|
def install(options = {})
|
||||||
require "descriptions"
|
require "descriptions"
|
||||||
raise TapAlreadyTappedError, name if installed?
|
raise TapAlreadyTappedError, name if installed?
|
||||||
|
clear_cache
|
||||||
|
|
||||||
# ensure git is installed
|
# ensure git is installed
|
||||||
Utils.ensure_git_installed!
|
Utils.ensure_git_installed!
|
||||||
@ -200,6 +214,7 @@ class Tap
|
|||||||
path.rmtree
|
path.rmtree
|
||||||
path.parent.rmdir_if_possible
|
path.parent.rmdir_if_possible
|
||||||
puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
|
puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
|
||||||
|
clear_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
def unlink_manpages
|
def unlink_manpages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user