Unrefactor broken tap

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Adrian Ho 2021-06-02 00:08:33 +08:00 committed by Adrian Ho
parent c7bbb904e8
commit 1cf8b43966

View File

@ -147,25 +147,23 @@ module Homebrew
end
end
def broken_tap_msg(tap)
<<~EOS
#{tap.full_name} was not tapped properly.
To fix:
rm -rf "#{tap.path}"
brew tap #{tap.name}
EOS
end
def broken_tap(tap)
return unless Utils::Git.available?
return unless HOMEBREW_REPOSITORY.git?
return broken_tap_msg(tap) if tap.remote.blank?
message = <<~EOS
#{tap.full_name} was not tapped properly! Run:
rm -rf "#{tap.path}"
brew tap #{tap.name}
EOS
return message if tap.remote.blank?
tap_head = tap.git_head
return broken_tap_msg(tap) if tap_head.blank?
return message if tap_head.blank?
return if tap_head != HOMEBREW_REPOSITORY.git_head
return broken_tap_msg(tap) if tap_head == HOMEBREW_REPOSITORY.git_head
message
end
def check_for_installed_developer_tools